Skip to content

miniproto_native::transport::TransportCodec::encode_packet

  • Crate: miniproto_native
  • Rust visibility: restricted
  • Source: rust/miniproto/src/transport.rs
  • Python exposure: miniproto._native.TransportCodec.encode_packet (confirmed from adjacent PyO3 attributes)
fn encode_packet(self: &Self, payload: &[u8], quick_ack: bool) -> _
  • payload: Complete MTProto payload to frame.
  • quick_ack: Whether to set the outbound quick-ACK request bit where the mode supports it.
  • fn encode_packet(&self, payload: &[u8], quick_ack: bool) -> PyResult<Vec<u8>>

    Encodes Python encode_packet(payload, quick_ack=False) into a single TCP frame.

    Returns ValueError for oversized payloads, invalid abridged alignment, length overflow,

    or operating-system randomness failure in padded mode.

    • payload: Complete MTProto payload to frame.

    • quick_ack: Whether to set the outbound quick-ACK request bit where the mode supports it.