Trait nix_daemon::Progress
source · pub trait Progress: Send {
type T: Send;
type Error: From<Error> + Send + Sync;
// Required methods
fn next(
&mut self,
) -> impl Future<Output = Result<Option<Stderr>, Self::Error>> + Send;
fn result(self) -> impl Future<Output = Result<Self::T, Self::Error>> + Send;
}
Expand description
An in-progress operation, which may produces a series of Stderr
s before returning.
All functions on the Store trait return these wrappers. If you just want the final result, not play-by-play updates on eg. log output or paths built:
use nix_daemon::{Store, Progress, nix::DaemonStore};
let is_valid_path = store.is_valid_path("/nix/store/...").await?.result().await?;
Otherwise, if you are interested in (some of) the progress updates:
use nix_daemon::{Store, Progress, nix::DaemonStore};
let mut prog = store.is_valid_path("/nix/store/...").await?;
while let Some(stderr) = prog.next().await? {
match stderr {
_ => todo!(),
}
}
let is_valid_path = prog.result().await?;
Required Associated Types§
Required Methods§
sourcefn next(
&mut self,
) -> impl Future<Output = Result<Option<Stderr>, Self::Error>> + Send
fn next( &mut self, ) -> impl Future<Output = Result<Option<Stderr>, Self::Error>> + Send
Returns the next Stderr message, or None after all have been consumed. This must behave like a fused iterator - once None is returned, all further calls must immediately return None, without corrupting the underlying datastream, etc.
Object Safety§
This trait is not object safe.