pub struct Message { /* private fields */ }Expand description
Type used for communication between a parent and child process.
It act as a wrapper around bytes, which enables of easy conversion from/to strings
and Rust types implementing Serialize and Deserialize traits.
Implementations§
Source§impl Message
impl Message
Sourcepub fn from_bytes<T>(bytes: T) -> Self
pub fn from_bytes<T>(bytes: T) -> Self
Create new message from given bytes.
Sourcepub fn from_string<S>(value: S) -> Self
pub fn from_string<S>(value: S) -> Self
Create new message from given string.
Sourcepub fn into_bytes(self) -> Vec<u8> ⓘ
pub fn into_bytes(self) -> Vec<u8> ⓘ
Convert message into bytes.
Sourcepub fn try_into_string(self) -> Result<String, FromUtf8Error>
pub fn try_into_string(self) -> Result<String, FromUtf8Error>
Try to convert message into string.
Sourcepub fn deserialize<T>(&self, format: &MessageFormat) -> Result<T, SerdeError>where
T: for<'de> Deserialize<'de>,
Available on crate features json or message-pack only.
pub fn deserialize<T>(&self, format: &MessageFormat) -> Result<T, SerdeError>where
T: for<'de> Deserialize<'de>,
json or message-pack only.Deserialize message into Rust type implementing Deserialize trait.
Sourcepub fn from_serializable<S>(
data: &S,
format: &MessageFormat,
) -> Result<Message, SerdeError>where
S: Serialize,
Available on crate features json or message-pack only.
pub fn from_serializable<S>(
data: &S,
format: &MessageFormat,
) -> Result<Message, SerdeError>where
S: Serialize,
json or message-pack only.Create new message message from Rust type implementing Serialize trait and with given data format.
Trait Implementations§
Source§impl Ord for Message
impl Ord for Message
Source§impl PartialOrd for Message
impl PartialOrd for Message
impl Eq for Message
impl StructuralPartialEq for Message
Auto Trait Implementations§
impl Freeze for Message
impl RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnwindSafe for Message
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