pub struct SecretaryContext<State> { /* private fields */ }Expand description
Implementations§
Source§impl<State> SecretaryContext<State>
impl<State> SecretaryContext<State>
Sourcepub fn new(state: State) -> SecretaryContext<State>
pub fn new(state: State) -> SecretaryContext<State>
创建新的上下文
Sourcepub fn state_mut(&mut self) -> &mut State
pub fn state_mut(&mut self) -> &mut State
获取状态可变引用
Sourcepub fn set_metadata<T>(&mut self, key: impl Into<String>, value: T)
pub fn set_metadata<T>(&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>(&mut self, key: impl Into<String>, resource: Arc<T>)
pub fn register_resource<T>(&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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Message for T
impl<T> Message for T
Source§fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
Convert a BoxedMessage to this concrete type
Source§fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
Convert this message to a BoxedMessage