From eb67b255f0dbbb3172ac6139db81638ee474a415 Mon Sep 17 00:00:00 2001 From: askiiart Date: Sat, 11 Jan 2025 14:09:51 -0600 Subject: [PATCH 1/2] add String to Line funcs --- src/lib.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 3fdcf24..ad6d6f0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -84,6 +84,24 @@ pub struct Line { pub content: String, } +impl Line { + pub fn from_stdout>(content: S) -> Self { + return Line { + content: content.as_ref().to_string(), + printed_to: LineType::Stdout, + time: Instant::now(), + }; + } + + pub fn from_stderr>(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 { From 8c353259505946df2e79f4c649ce4be5ddb20994 Mon Sep 17 00:00:00 2001 From: askiiart Date: Sat, 11 Jan 2025 14:54:37 -0600 Subject: [PATCH 2/2] fix from_stdout/err --- src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index ad6d6f0..ebaec5e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -85,7 +85,7 @@ pub struct Line { } impl Line { - pub fn from_stdout>(content: S) -> Self { + pub fn from_stdout>(content: S) -> Self { return Line { content: content.as_ref().to_string(), printed_to: LineType::Stdout, @@ -93,7 +93,7 @@ impl Line { }; } - pub fn from_stderr>(content: S) -> Self { + pub fn from_stderr>(content: S) -> Self { return Line { content: content.as_ref().to_string(), printed_to: LineType::Stderr,