pub struct ShutdownResourceComponent<T> { /* private fields */ }Expand description
Runtime component for one shutdown-only owned resource.
This adapter is useful for product-owned resources whose lifecycle is otherwise simple: declare a component, optional dependencies, and a shutdown phase that consumes the resource exactly once. Product crates still own the resource type and the shutdown closure; Forge owns the component boilerplate.
Implementations§
Source§impl<T> ShutdownResourceComponent<T>
impl<T> ShutdownResourceComponent<T>
Sourcepub fn new<F, Fut>(
component_name: &'static str,
kind: RuntimeComponentKind,
phase_name: &'static str,
resource: T,
shutdown: F,
) -> Self
pub fn new<F, Fut>( component_name: &'static str, kind: RuntimeComponentKind, phase_name: &'static str, resource: T, shutdown: F, ) -> Self
Creates a shutdown-only resource component.
Sourcepub const fn depends_on_all(self, dependencies: &'static [&'static str]) -> Self
pub const fn depends_on_all(self, dependencies: &'static [&'static str]) -> Self
Declares components that must shut down before this resource.
Trait Implementations§
Source§impl<T> RuntimeComponentBundle for ShutdownResourceComponent<T>where
T: Send + 'static,
impl<T> RuntimeComponentBundle for ShutdownResourceComponent<T>where
T: Send + 'static,
Source§fn register(self, registry: &mut RuntimeComponentRegistry)
fn register(self, registry: &mut RuntimeComponentRegistry)
Registers this bundle into the runtime component registry.
Auto Trait Implementations§
impl<T> Freeze for ShutdownResourceComponent<T>where
T: Freeze,
impl<T> !RefUnwindSafe for ShutdownResourceComponent<T>
impl<T> Send for ShutdownResourceComponent<T>where
T: Send,
impl<T> !Sync for ShutdownResourceComponent<T>
impl<T> Unpin for ShutdownResourceComponent<T>where
T: Unpin,
impl<T> UnsafeUnpin for ShutdownResourceComponent<T>where
T: UnsafeUnpin,
impl<T> !UnwindSafe for ShutdownResourceComponent<T>
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
Mutably borrows from an owned value. Read more