[−][src]Struct grammers_mtproto::PlainMtp
An implementation of the Mobile Transport Protocol for plaintext (unencrypted) messages.
The reason to separate the plaintext and encrypted implementations for serializing messages is that, even though they are similar, the benefits outweight some minor code reuse.
This way, the encryption key for Mtp
is mandatory so errors
for trying to encrypt data without a key are completely eliminated.
Also, the plaintext part of the protocol does not need to deal with the complexity of the full protocol once encrypted messages are used, so being able to keep a simpler implementation separate is a bonus.
Implementations
impl PlainMtp
[src]
pub fn new() -> Self
[src]
pub fn serialize_plain_message(&mut self, body: &[u8]) -> Vec<u8>
[src]
Wraps a request's data into a plain message (also known as unencrypted messages), and returns its serialized contents.
Plain messages may be used for requests that don't require an authorization key to be present, such as those needed to generate the authorization key itself.
pub fn deserialize_plain_message<'a>(
&self,
message: &'a [u8]
) -> Result<&'a [u8], DeserializeError>
[src]
&self,
message: &'a [u8]
) -> Result<&'a [u8], DeserializeError>
Validates that the returned data is a correct plain message, and if it is, the method returns the inner contents of the message.
Auto Trait Implementations
impl RefUnwindSafe for PlainMtp
impl Send for PlainMtp
impl Sync for PlainMtp
impl Unpin for PlainMtp
impl UnwindSafe for PlainMtp
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,