Enum vodozemac::olm::OlmMessage
source · [−]pub enum OlmMessage {
Normal(Message),
PreKey(PreKeyMessage),
}
Expand description
Enum over the different Olm message types.
Olm uses two types of messages. The underlying transport protocol must provide a means for recipients to distinguish between them.
OlmMessage
provides Serialize
and Deserialize
implementations
that are compatible with Matrix.
Variants
Normal(Message)
A normal message, contains only the ciphertext and metadata to decrypt it.
PreKey(PreKeyMessage)
Implementations
sourceimpl OlmMessage
impl OlmMessage
sourcepub fn from_parts(
message_type: usize,
ciphertext: &str
) -> Result<Self, DecodeError>
pub fn from_parts(
message_type: usize,
ciphertext: &str
) -> Result<Self, DecodeError>
Create a OlmMessage
from a message type and a ciphertext.
sourcepub fn message(&self) -> &[u8]ⓘNotable traits for &[u8]impl<'_> Read for &[u8]impl<'_> Write for &mut [u8]
pub fn message(&self) -> &[u8]ⓘNotable traits for &[u8]impl<'_> Read for &[u8]impl<'_> Write for &mut [u8]
Get the message as a byte array.
sourcepub fn message_type(&self) -> MessageType
pub fn message_type(&self) -> MessageType
Get the type of the message.
Trait Implementations
sourceimpl Clone for OlmMessage
impl Clone for OlmMessage
sourcefn clone(&self) -> OlmMessage
fn clone(&self) -> OlmMessage
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 Debug for OlmMessage
impl Debug for OlmMessage
sourceimpl<'de> Deserialize<'de> for OlmMessage
impl<'de> Deserialize<'de> for OlmMessage
sourcefn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
sourceimpl From<Message> for OlmMessage
impl From<Message> for OlmMessage
sourceimpl From<PreKeyMessage> for OlmMessage
impl From<PreKeyMessage> for OlmMessage
sourcefn from(m: PreKeyMessage) -> Self
fn from(m: PreKeyMessage) -> Self
Converts to this type from the input type.
sourceimpl PartialEq<OlmMessage> for OlmMessage
impl PartialEq<OlmMessage> for OlmMessage
sourcefn eq(&self, other: &OlmMessage) -> bool
fn eq(&self, other: &OlmMessage) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &OlmMessage) -> bool
fn ne(&self, other: &OlmMessage) -> bool
This method tests for !=
.
sourceimpl Serialize for OlmMessage
impl Serialize for OlmMessage
impl Eq for OlmMessage
impl StructuralEq for OlmMessage
impl StructuralPartialEq for OlmMessage
Auto Trait Implementations
impl RefUnwindSafe for OlmMessage
impl Send for OlmMessage
impl Sync for OlmMessage
impl Unpin for OlmMessage
impl UnwindSafe for OlmMessage
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more