pub struct Local<T>(_);
Expand description
Used to send values that cannot be serialized. Works inside the current node only.
Messages must be instances of Clone
, Serialize
and Deserialize
because
of network communication and message dumping. However, in some cases, it’s
desired to have messages that cannot satisfy requirements.
For instance, when sending channels.
Local<T>
implements Debug
, Serialize
and Deserialize
for any T
.
Meanwhile, it can be serialized (but w/o useful information), it cannot be
deserialized (it returns an error on attempts).
Example
#[message]
pub struct OpenDirectChannel {
pub tx: Local<mpsc::Sender>,
}
Implementations
sourceimpl<T> Local<T>
impl<T> Local<T>
pub fn into_inner(self) -> T
Trait Implementations
sourceimpl<'de, T> Deserialize<'de> for Local<T>
impl<'de, T> Deserialize<'de> for Local<T>
sourcefn 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<T: Copy> Copy for Local<T>
impl<T: Eq> Eq for Local<T>
impl<T> StructuralEq for Local<T>
impl<T> StructuralPartialEq for Local<T>
Auto Trait Implementations
impl<T> RefUnwindSafe for Local<T> where
T: RefUnwindSafe,
impl<T> Send for Local<T> where
T: Send,
impl<T> Sync for Local<T> where
T: Sync,
impl<T> Unpin for Local<T> where
T: Unpin,
impl<T> UnwindSafe for Local<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T, A> DynAccess<T> for A where
A: Access<T>,
<A as Access<T>>::Guard: 'static,
impl<T, A> DynAccess<T> for A where
A: Access<T>,
<A as Access<T>>::Guard: 'static,
sourcepub fn load(&self) -> DynGuard<T>
pub fn load(&self) -> DynGuard<T>
The equivalent of Access::load
.
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> Serialize for T where
T: Serialize + ?Sized,
impl<T> Serialize for T where
T: Serialize + ?Sized,
pub fn erased_serialize(
&self,
serializer: &mut dyn Serializer
) -> Result<Ok, Error>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more