pub struct SecretaryContext<State> { /* private fields */ }Expand description
Implementations§
Source§impl<State> SecretaryContext<State>
impl<State> SecretaryContext<State>
Sourcepub fn state_mut(&mut self) -> &mut State
pub fn state_mut(&mut self) -> &mut State
获取状态可变引用
Sourcepub fn set_metadata<T: Any + Send + Sync>(
&mut self,
key: impl Into<String>,
value: T,
)
pub fn set_metadata<T: Any + Send + Sync>( &mut self, key: impl Into<String>, value: T, )
设置元数据
Sourcepub fn remove_metadata(&mut self, key: &str) -> bool
pub fn remove_metadata(&mut self, key: &str) -> bool
移除元数据
Sourcepub fn register_resource<T: Any + Send + Sync>(
&mut self,
key: impl Into<String>,
resource: Arc<T>,
)
pub fn register_resource<T: Any + Send + Sync>( &mut self, key: impl Into<String>, resource: Arc<T>, )
注册共享资源
Sourcepub fn has_resource(&self, key: &str) -> bool
pub fn has_resource(&self, key: &str) -> bool
检查资源是否存在
Auto Trait Implementations§
impl<State> Freeze for SecretaryContext<State>where
State: Freeze,
impl<State> !RefUnwindSafe for SecretaryContext<State>
impl<State> Send for SecretaryContext<State>where
State: Send,
impl<State> Sync for SecretaryContext<State>where
State: Sync,
impl<State> Unpin for SecretaryContext<State>where
State: Unpin,
impl<State> UnsafeUnpin for SecretaryContext<State>where
State: UnsafeUnpin,
impl<State> !UnwindSafe for SecretaryContext<State>
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