pub struct CommandOutput { /* private fields */ }Expand description
Destination and presentation contract for a backup command result.
A successful command emits at most once. File output is replaced only when the result is ready, so validation and command failures preserve any pre-existing destination.
Implementations§
Source§impl CommandOutput
impl CommandOutput
Sourcepub fn new(mode: OutputMode, path: Option<PathBuf>) -> Self
pub fn new(mode: OutputMode, path: Option<PathBuf>) -> Self
Creates an output contract for mode, writing to path when supplied
and to stdout otherwise.
Sourcepub const fn mode(&self) -> OutputMode
pub const fn mode(&self) -> OutputMode
The requested presentation mode.
Sourcepub const fn allows_progress(&self) -> bool
pub const fn allows_progress(&self) -> bool
True when interactive progress reporting is appropriate: only for human output going to a terminal that is not competing with a machine-readable result document.
Sourcepub fn ensure_distinct_from(
&self,
other: &Path,
description: &str,
) -> Result<()>
pub fn ensure_distinct_from( &self, other: &Path, description: &str, ) -> Result<()>
Rejects a result destination that aliases a command input or artifact.
Existing files are compared by filesystem identity, including hard links. Non-existing paths are compared after resolving their nearest existing ancestor, so relative paths and symlinked parent directories cannot bypass the check.
Sourcepub fn emit_json<T: Serialize + ?Sized>(&self, value: &T) -> Result<()>
pub fn emit_json<T: Serialize + ?Sized>(&self, value: &T) -> Result<()>
Renders value as JSON, honoring compact/indented/quiet modes.
Use Self::emit when the command also has a human rendering.
Sourcepub fn emit_text(&self, text: &str) -> Result<()>
pub fn emit_text(&self, text: &str) -> Result<()>
Writes already-rendered text, honoring quiet mode and file routing.
Trait Implementations§
Source§impl Clone for CommandOutput
impl Clone for CommandOutput
Source§fn clone(&self) -> CommandOutput
fn clone(&self) -> CommandOutput
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CommandOutput
impl Debug for CommandOutput
Source§impl Default for CommandOutput
impl Default for CommandOutput
Source§fn default() -> CommandOutput
fn default() -> CommandOutput
Auto Trait Implementations§
impl Freeze for CommandOutput
impl RefUnwindSafe for CommandOutput
impl Send for CommandOutput
impl Sync for CommandOutput
impl Unpin for CommandOutput
impl UnsafeUnpin for CommandOutput
impl UnwindSafe for CommandOutput
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<K, Q> Comparable<Q> for K
impl<K, Q> Comparable<Q> for K
Source§impl<K, Q> Equivalent<Q> for K
impl<K, Q> Equivalent<Q> for K
Source§fn equivalent(&self, key: &Q) -> bool
fn equivalent(&self, key: &Q) -> bool
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request