pub enum RoomMessageBody {
Public {
plaintext: String,
},
Private {
ciphertext: Vec<u8>,
nonce: [u8; 12],
secret_version: SecretVersion,
},
}Expand description
Message body that can be either public plaintext or private encrypted
Variants§
Implementations§
Source§impl RoomMessageBody
impl RoomMessageBody
Sourcepub fn private(
ciphertext: Vec<u8>,
nonce: [u8; 12],
secret_version: SecretVersion,
) -> Self
pub fn private( ciphertext: Vec<u8>, nonce: [u8; 12], secret_version: SecretVersion, ) -> Self
Create a new private message
Sourcepub fn is_private(&self) -> bool
pub fn is_private(&self) -> bool
Check if this is a private message
Sourcepub fn content_len(&self) -> usize
pub fn content_len(&self) -> usize
Get the content length for validation
Sourcepub fn secret_version(&self) -> Option<SecretVersion>
pub fn secret_version(&self) -> Option<SecretVersion>
Get the secret version (if private)
Sourcepub fn to_string_lossy(&self) -> String
pub fn to_string_lossy(&self) -> String
Get a string representation for display purposes This is a temporary helper for UI integration during development
Sourcepub fn as_public_string(&self) -> Option<&str>
pub fn as_public_string(&self) -> Option<&str>
Try to get the public plaintext, returns None if private
Trait Implementations§
Source§impl Clone for RoomMessageBody
impl Clone for RoomMessageBody
Source§fn clone(&self) -> RoomMessageBody
fn clone(&self) -> RoomMessageBody
Returns a duplicate 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 RoomMessageBody
impl Debug for RoomMessageBody
Source§impl<'de> Deserialize<'de> for RoomMessageBody
impl<'de> Deserialize<'de> for RoomMessageBody
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 Display for RoomMessageBody
impl Display for RoomMessageBody
Source§impl PartialEq for RoomMessageBody
impl PartialEq for RoomMessageBody
Source§impl Serialize for RoomMessageBody
impl Serialize for RoomMessageBody
impl StructuralPartialEq for RoomMessageBody
Auto Trait Implementations§
impl Freeze for RoomMessageBody
impl RefUnwindSafe for RoomMessageBody
impl Send for RoomMessageBody
impl Sync for RoomMessageBody
impl Unpin for RoomMessageBody
impl UnwindSafe for RoomMessageBody
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