pub struct IntermediateTransport { /* private fields */ }Expand description
MTProto Intermediate transport framing.
Init byte: 0xeeeeeeee (4 bytes). Each message is prefixed with its
4-byte little-endian byte length.
Implementations§
Source§impl IntermediateTransport
impl IntermediateTransport
Sourcepub async fn connect(addr: &str) -> Result<Self, InvocationError>
pub async fn connect(addr: &str) -> Result<Self, InvocationError>
Connect and send the 4-byte init header.
Sourcepub fn from_stream(stream: TcpStream) -> Self
pub fn from_stream(stream: TcpStream) -> Self
Wrap an existing stream (the init byte will be sent on first [send]).
Sourcepub async fn send(&mut self, data: &[u8]) -> Result<(), InvocationError>
pub async fn send(&mut self, data: &[u8]) -> Result<(), InvocationError>
Send a message with Intermediate framing.
Sourcepub async fn recv(&mut self) -> Result<Vec<u8>, InvocationError>
pub async fn recv(&mut self) -> Result<Vec<u8>, InvocationError>
Receive the next Intermediate-framed message.
pub fn into_inner(self) -> TcpStream
Auto Trait Implementations§
impl !Freeze for IntermediateTransport
impl RefUnwindSafe for IntermediateTransport
impl Send for IntermediateTransport
impl Sync for IntermediateTransport
impl Unpin for IntermediateTransport
impl UnsafeUnpin for IntermediateTransport
impl UnwindSafe for IntermediateTransport
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