Struct elfo_core::MoveOwnership
source · [−]pub struct MoveOwnership<T>(_);
Expand description
Used to transfer ownership over messaging.
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 sockets or files.
MoveOwnership<T>
implements Debug
, Clone
, 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 HandleFile {
pub path: PathBuf,
pub file: MoveOwnership<File>,
}
Implementations
sourceimpl<T> MoveOwnership<T>
impl<T> MoveOwnership<T>
Trait Implementations
sourceimpl<T> Clone for MoveOwnership<T>
impl<T> Clone for MoveOwnership<T>
sourcefn clone(&self) -> MoveOwnership<T>
fn clone(&self) -> MoveOwnership<T>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<T> Debug for MoveOwnership<T>
impl<T> Debug for MoveOwnership<T>
sourceimpl<'de, T> Deserialize<'de> for MoveOwnership<T>
impl<'de, T> Deserialize<'de> for MoveOwnership<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
sourceimpl<T> From<T> for MoveOwnership<T>
impl<T> From<T> for MoveOwnership<T>
sourceimpl<T> Serialize for MoveOwnership<T>
impl<T> Serialize for MoveOwnership<T>
Auto Trait Implementations
impl<T> !RefUnwindSafe for MoveOwnership<T>
impl<T> Send for MoveOwnership<T> where
T: Send,
impl<T> Sync for MoveOwnership<T> where
T: Send,
impl<T> Unpin for MoveOwnership<T>
impl<T> !UnwindSafe for MoveOwnership<T>
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> 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