add String to Line funcs
This commit is contained in:
parent
cd41376c22
commit
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,
|
||||
}
|
||||
|
||||
impl Line {
|
||||
pub fn from_stdout<S: AsRef<String>>(content: S) -> Self {
|
||||
return Line {
|
||||
content: content.as_ref().to_string(),
|
||||
printed_to: LineType::Stdout,
|
||||
time: Instant::now(),
|
||||
};
|
||||
}
|
||||
|
||||
pub fn from_stderr<S: AsRef<String>>(content: S) -> Self {
|
||||
return Line {
|
||||
content: content.as_ref().to_string(),
|
||||
printed_to: LineType::Stderr,
|
||||
time: Instant::now(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialOrd for Line {
|
||||
fn ge(&self, other: &Line) -> bool {
|
||||
if self.time >= other.time {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue