pub enum Lifecycle {
Singleton,
RequestScoped,
Transient,
}
Expand description
How many times should a constructor be invoked?
Variants§
Singleton
The constructor for a Singleton
type is invoked at most once.
As a consequence, there is at most one instance of Singleton
types,
stored inside the server’s global state.
RequestScoped
The constructor for a RequestScoped
type is invoked at most once for every incoming request.
As a consequence, there is at most one instance of RequestScoped
types for every incoming
request.
Transient
The constructor for a Transient
type is invoked every single time an instance of the type
is required.
As a consequence, there can be multiple instances of Transient
types for every
incoming request.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Lifecycle
impl<'de> Deserialize<'de> for Lifecycle
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Copy for Lifecycle
impl Eq for Lifecycle
impl StructuralPartialEq for Lifecycle
Auto Trait Implementations§
impl Freeze for Lifecycle
impl RefUnwindSafe for Lifecycle
impl Send for Lifecycle
impl Sync for Lifecycle
impl Unpin for Lifecycle
impl UnwindSafe for Lifecycle
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.