pub struct WetContext { /* private fields */ }Expand description
WetContext contains runtime references (services, connections, etc.)
Implementations§
Source§impl WetContext
impl WetContext
pub fn new() -> Self
pub fn with_ref<T: Any + Send + Sync>( self, key: impl Into<String>, value: T, ) -> Self
pub fn insert_ref<T: Any + Send + Sync>( &mut self, key: impl Into<String>, value: T, )
pub fn insert_arc( &mut self, key: impl Into<String>, value: Arc<dyn Any + Send + Sync>, )
pub fn get_ref<T: Any + Send + Sync>(&self, key: &str) -> Option<Arc<T>>
pub fn get_required<T: Any + Send + Sync>( &self, key: &str, ) -> Result<Arc<T>, OpError>
pub fn contains(&self, key: &str) -> bool
pub fn keys(&self) -> impl Iterator<Item = &String>
Sourcepub async fn ensure<T, F>(
&mut self,
key: &str,
dry: &mut DryContext,
factory: F,
) -> Result<Arc<T>, OpError>
pub async fn ensure<T, F>( &mut self, key: &str, dry: &mut DryContext, factory: F, ) -> Result<Arc<T>, OpError>
Get a reference or compute it using an async closure that has access to both contexts
pub fn merge(&mut self, other: WetContext)
Trait Implementations§
Source§impl Debug for WetContext
impl Debug for WetContext
Source§impl Default for WetContext
impl Default for WetContext
Source§fn default() -> WetContext
fn default() -> WetContext
Returns the “default value” for a type. Read more
impl Send for WetContext
impl Sync for WetContext
Auto Trait Implementations§
impl !RefUnwindSafe for WetContext
impl !UnwindSafe for WetContext
impl Freeze for WetContext
impl Unpin for WetContext
impl UnsafeUnpin for WetContext
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