pub struct Live(/* private fields */);Expand description
Where a running tool reports output as it comes, such as
Shell’s lines. Cloning shares the sink.
use std::sync::{Arc, Mutex};
use rig_tools::Live;
let seen = Arc::new(Mutex::new(String::new()));
let live = Live::new({
let seen = seen.clone();
move |text| seen.lock().map(|mut seen| seen.push_str(text)).unwrap_or_default()
});
live.line("building\n");
assert_eq!(seen.lock().map(|seen| seen.clone()).ok().as_deref(), Some("building\n"));Implementations§
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Live
impl !UnwindSafe for Live
impl Freeze for Live
impl Send for Live
impl Sync for Live
impl Unpin for Live
impl UnsafeUnpin for Live
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more