pub enum Handle {
Stdout,
Stdin(Arc<Mutex<ChildStdin>>),
Collect(Arc<Mutex<Vec<Output<Value>>>>),
Stream(UnboundedSender<Output<Value>>),
}Expand description
Destination for super::Output::emit.
Arc<tokio::sync::Mutex<_>> on the non-unit variants lets the
handle be cloned cheaply across the command tree’s call chain and
guarantees concurrent emits serialize correctly. tokio::sync::Mutex
(not std::sync::Mutex) because we hold the guard across .await
boundaries during async writes, which would deadlock with std’s.
Variants§
Stdout
Write each line to this process’s stdout; mirror fatal
Output::Error lines to stderr.
Stdin(Arc<Mutex<ChildStdin>>)
Write each line to a child process’s stdin.
Collect(Arc<Mutex<Vec<Output<Value>>>>)
Push each emitted Output<T> (reserialized as Output<Value>
for a uniform storage type) into a shared vector.
Stream(UnboundedSender<Output<Value>>)
Forward each emitted Output<T> through an mpsc channel
(reserialized as Output<Value> to match Collect’s storage
type). The receiver loops on rx.recv() until the cli’s
run() completes and the Handle is dropped — at which point
the sender side closes and the receiver’s loop exits.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Handle
impl !RefUnwindSafe for Handle
impl Send for Handle
impl Sync for Handle
impl Unpin for Handle
impl UnsafeUnpin for Handle
impl !UnwindSafe for Handle
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more