pub struct Deps { /* private fields */ }Expand description
A type-keyed container of cloneable services.
Built with Deps::builder and read by type via Deps::get, Deps::expect,
or Deps::try_get. Used by #[task]-generated from_deps constructors.
Implementations§
Source§impl Deps
impl Deps
Sourcepub fn builder() -> DepsBuilder
pub fn builder() -> DepsBuilder
Start a builder.
Sourcepub fn get<T>(&self) -> Option<T>
pub fn get<T>(&self) -> Option<T>
Resolve T, returning a fresh clone, or None if the type was never inserted.
Sourcepub fn try_get<T>(&self) -> Result<T, MissingDep>
pub fn try_get<T>(&self) -> Result<T, MissingDep>
Resolve T, returning a fresh clone, or MissingDep describing the missing type.
§Errors
Returns MissingDep if no value of type T was inserted into the container.
Sourcepub fn expect<T>(&self) -> T
pub fn expect<T>(&self) -> T
Resolve T, panicking with the type name on miss.
Use Deps::try_get (or Deps::get) when a missing dependency should
be a recoverable error. expect is meant for codegen sites that have
already been verified by verify_deps.
§Panics
Panics if no value of type T was inserted into the container.
Sourcepub fn contains<T>(&self) -> boolwhere
T: 'static,
pub fn contains<T>(&self) -> boolwhere
T: 'static,
Returns true if a value of type T is present.
Sourcepub fn merge(&mut self, other: Deps)
pub fn merge(&mut self, other: Deps)
Move every entry from other into self. For any type present in both
containers, the entry from other wins.
Use this to layer service containers — e.g. start from a base
container provided by a library, then merge in application-specific
services before passing the result to workflow! { deps: … }.
Merging does not retroactively affect tasks that were already constructed from this container (they hold their own clones).
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Deps
impl !UnwindSafe for Deps
impl Freeze for Deps
impl Send for Deps
impl Sync for Deps
impl Unpin for Deps
impl UnsafeUnpin for Deps
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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> 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::RequestSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.