pub struct Local<T>(/* private fields */);
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§
source§impl<T> Local<T>
impl<T> Local<T>
pub fn into_inner(self) -> T
Trait Implementations§
source§impl<'de, T> Deserialize<'de> for Local<T>
impl<'de, T> Deserialize<'de> for Local<T>
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
source§impl<T: PartialEq> PartialEq for Local<T>
impl<T: PartialEq> PartialEq for Local<T>
impl<T: Copy> Copy for Local<T>
impl<T: Eq> Eq for Local<T>
impl<T> StructuralPartialEq for Local<T>
Auto Trait Implementations§
impl<T> Freeze for Local<T>where
T: Freeze,
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§
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, A> DynAccess<T> for A
impl<T, A> DynAccess<T> for A
source§fn load(&self) -> DynGuard<T>
fn load(&self) -> DynGuard<T>
The equivalent of
Access::load
.