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§
Source§impl OlmMessage
impl OlmMessage
Sourcepub fn from_parts(
message_type: usize,
ciphertext: &[u8],
) -> Result<Self, DecodeError>
pub fn from_parts( message_type: usize, ciphertext: &[u8], ) -> Result<Self, DecodeError>
Create an OlmMessage
from a message type and a ciphertext.
Sourcepub const fn message_type(&self) -> MessageType
pub const fn message_type(&self) -> MessageType
Get the type of the message.
Trait Implementations§
Source§impl Clone for OlmMessage
impl Clone for OlmMessage
Source§fn clone(&self) -> OlmMessage
fn clone(&self) -> OlmMessage
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for OlmMessage
impl Debug for OlmMessage
Source§impl<'de> Deserialize<'de> for OlmMessage
impl<'de> Deserialize<'de> for OlmMessage
Source§fn 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
Source§impl From<Message> for OlmMessage
impl From<Message> for OlmMessage
Source§impl From<PreKeyMessage> for OlmMessage
impl From<PreKeyMessage> for OlmMessage
Source§fn from(m: PreKeyMessage) -> Self
fn from(m: PreKeyMessage) -> Self
Converts to this type from the input type.
Source§impl PartialEq for OlmMessage
impl PartialEq for OlmMessage
Source§impl Serialize for OlmMessage
impl Serialize for OlmMessage
impl Eq for OlmMessage
impl StructuralPartialEq for OlmMessage
Auto Trait Implementations§
impl Freeze for OlmMessage
impl RefUnwindSafe for OlmMessage
impl Send for OlmMessage
impl Sync for OlmMessage
impl Unpin for OlmMessage
impl UnwindSafe for OlmMessage
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