pub struct Artifact<T> { /* private fields */ }Expand description
Owned artifact bytes with an optional destination suggestion and report.
Returned from a handler as Output::Artifact.
See the module docs for the destination policy and report channel.
Bytes are owned: streaming is deliberately not part of this contract.
Implementations§
Source§impl<T> Artifact<T>
impl<T> Artifact<T>
Sourcepub fn new(bytes: impl Into<Vec<u8>>) -> Self
pub fn new(bytes: impl Into<Vec<u8>>) -> Self
Creates an artifact from owned bytes, with no destination suggestion, no stdout fallback, and no report.
Such an artifact is only writable under an explicit output-file override; without one the run fails rather than guessing a destination.
Sourcepub fn suggest_destination(self, destination: impl Into<PathBuf>) -> Self
pub fn suggest_destination(self, destination: impl Into<PathBuf>) -> Self
Suggests where the bytes should land, and authorizes the framework to write there when no explicit override is given.
This opt-in is what separates an artifact from Output::Binary: a
filename on binary output is a hint to the caller, never a license to
touch the filesystem.
Sourcepub fn allow_stdout(self) -> Self
pub fn allow_stdout(self) -> Self
Authorizes stdout as the last-resort destination.
Without this, an artifact with no override and no suggestion is a typed failure. With it, the report is routed to stderr so it can never contaminate the bytes.
Sourcepub fn with_report(self, report: T) -> Self
pub fn with_report(self, report: T) -> Self
Attaches the application-owned semantic report rendered after the write.
The report is the application’s own type: counts, warnings, partial success — whatever taxonomy it owns. Standout only transports it.
Sourcepub fn suggested_destination(&self) -> Option<&Path>
pub fn suggested_destination(&self) -> Option<&Path>
Returns the suggested destination, if the application opted in.
Sourcepub fn stdout_allowed(&self) -> bool
pub fn stdout_allowed(&self) -> bool
Returns true if the application authorized the stdout fallback.