pub enum ServiceLifetime {
Singleton,
Scoped,
Transient,
}Expand description
Defines the lifetime of a service in the dependency injection container.
Variants§
Singleton
A single instance is created and shared across the entire application.
Scoped
A single instance is created per scope. Different scopes get different instances.
Transient
A new instance is created every time the service is requested.
Trait Implementations§
Source§impl Debug for ServiceLifetime
impl Debug for ServiceLifetime
Source§impl Hash for ServiceLifetime
impl Hash for ServiceLifetime
Source§impl Ord for ServiceLifetime
impl Ord for ServiceLifetime
Source§fn cmp(&self, other: &ServiceLifetime) -> Ordering
fn cmp(&self, other: &ServiceLifetime) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for ServiceLifetime
impl PartialEq for ServiceLifetime
Source§impl PartialOrd for ServiceLifetime
impl PartialOrd for ServiceLifetime
impl Eq for ServiceLifetime
impl StructuralPartialEq for ServiceLifetime
Auto Trait Implementations§
impl Freeze for ServiceLifetime
impl RefUnwindSafe for ServiceLifetime
impl Send for ServiceLifetime
impl Sync for ServiceLifetime
impl Unpin for ServiceLifetime
impl UnwindSafe for ServiceLifetime
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