Compare commits
2 commits
cd41376c22
...
8c35325950
Author | SHA1 | Date | |
---|---|---|---|
|
8c35325950 | ||
|
eb67b255f0 |
1 changed files with 18 additions and 0 deletions
18
src/lib.rs
18
src/lib.rs
|
@ -84,6 +84,24 @@ pub struct Line {
|
||||||
pub content: String,
|
pub content: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Line {
|
||||||
|
pub fn from_stdout<S: AsRef<str>>(content: S) -> Self {
|
||||||
|
return Line {
|
||||||
|
content: content.as_ref().to_string(),
|
||||||
|
printed_to: LineType::Stdout,
|
||||||
|
time: Instant::now(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn from_stderr<S: AsRef<str>>(content: S) -> Self {
|
||||||
|
return Line {
|
||||||
|
content: content.as_ref().to_string(),
|
||||||
|
printed_to: LineType::Stderr,
|
||||||
|
time: Instant::now(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl PartialOrd for Line {
|
impl PartialOrd for Line {
|
||||||
fn ge(&self, other: &Line) -> bool {
|
fn ge(&self, other: &Line) -> bool {
|
||||||
if self.time >= other.time {
|
if self.time >= other.time {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue