pub struct FullTransport { /* private fields */ }Expand description
MTProto Full transport framing.
Extends Intermediate with:
- 4-byte little-endian sequence number (auto-incremented per message).
- 4-byte CRC-32 at the end of each packet covering
[len][seq_no][payload].
No init byte is sent; the full format is detected by the absence of
0xef / 0xee in the first byte.
Implementations§
Source§impl FullTransport
impl FullTransport
pub async fn connect(addr: &str) -> Result<Self, InvocationError>
pub fn from_stream(stream: TcpStream) -> Self
Sourcepub async fn send(&mut self, data: &[u8]) -> Result<(), InvocationError>
pub async fn send(&mut self, data: &[u8]) -> Result<(), InvocationError>
Send a message with Full framing (length + seqno + payload + crc32).
Sourcepub async fn recv(&mut self) -> Result<Vec<u8>, InvocationError>
pub async fn recv(&mut self) -> Result<Vec<u8>, InvocationError>
Receive the next Full-framed message; validates the CRC-32.
pub fn into_inner(self) -> TcpStream
Auto Trait Implementations§
impl !Freeze for FullTransport
impl RefUnwindSafe for FullTransport
impl Send for FullTransport
impl Sync for FullTransport
impl Unpin for FullTransport
impl UnsafeUnpin for FullTransport
impl UnwindSafe for FullTransport
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> 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