Compare commits

...

2 commits

Author SHA1 Message Date
askiiart
8c35325950
fix from_stdout/err 2025-01-11 14:54:37 -06:00
askiiart
eb67b255f0
add String to Line funcs 2025-01-11 14:09:51 -06:00

View file

@ -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 {