pub enum HandleDestination {
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.
Trait Implementations§
Source§impl Clone for HandleDestination
impl Clone for HandleDestination
Source§fn clone(&self) -> HandleDestination
fn clone(&self) -> HandleDestination
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Default for HandleDestination
impl Default for HandleDestination
Source§impl From<HandleDestination> for Handle
impl From<HandleDestination> for Handle
Source§fn from(destination: HandleDestination) -> Self
fn from(destination: HandleDestination) -> Self
Auto Trait Implementations§
impl Freeze for HandleDestination
impl !RefUnwindSafe for HandleDestination
impl Send for HandleDestination
impl Sync for HandleDestination
impl Unpin for HandleDestination
impl UnsafeUnpin for HandleDestination
impl !UnwindSafe for HandleDestination
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