pub struct TdfFile {
pub version: u32,
pub payload: Vec<u8>,
}Expand description
A decoded TDF$ file: the app version that wrote it and its payload.
Fields§
§version: u32Telegram Desktop version number stored after the magic.
payload: Vec<u8>Bytes between the header and the checksum.
Implementations§
Source§impl TdfFile
impl TdfFile
Sourcepub fn parse(data: &[u8]) -> Result<Self>
pub fn parse(data: &[u8]) -> Result<Self>
Decodes the bytes of a whole TDF$ file and checks its MD5.
§Errors
Error::QDataStreamFailedwhen the input is too short to hold the magic, the version, and the checksum.Error::InvalidMagicwhen it does not start withTDF$.Error::InvalidCheckSumwhen the stored MD5 does not match.
The errors name no file; read fills in the name it read.
Trait Implementations§
impl Eq for TdfFile
impl StructuralPartialEq for TdfFile
Auto Trait Implementations§
impl Freeze for TdfFile
impl RefUnwindSafe for TdfFile
impl Send for TdfFile
impl Sync for TdfFile
impl Unpin for TdfFile
impl UnsafeUnpin for TdfFile
impl UnwindSafe for TdfFile
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more