Skip to content

miniproto_native::tl::tl_fast_decode

  • Crate: miniproto_native
  • Rust visibility: restricted
  • Source: rust/miniproto/src/tl.rs
  • Python exposure: miniproto._native.tl_fast_decode (confirmed from adjacent PyO3 attributes)
fn tl_fast_decode(py: _, constructor_id: u32, data: &[u8], offset: usize, boxed: bool) -> _
  • py: The acquired GIL token used to construct decoded Python values.
  • constructor_id: Generated TL constructor id selecting a trusted fast-path descriptor.
  • data: TL wire bytes to decode.
  • offset: Byte offset at which this constructor begins.
  • boxed: Whether data starts with and must match the constructor id.
fn tl_fast_decode(py: Python<'_>, constructor_id: u32, data: &[u8], offset: usize, boxed: bool) -> PyResult<Option<(Py<pyo3::types::PyTuple>, usize)>>

Defined in rust/miniproto/src/tl.rs:210-266

Attempts Python tl_fast_decode for a generated constructor at offset.

boxed requires and verifies the constructor id. Returns None if no native decoder exists, otherwise (values_tuple, next_offset); malformed wire input raises a Python exception. This conversion necessarily holds the GIL to create Python objects. PyO3 conversion errors are propagated unchanged, whereas malformed TL bytes use ValueError. Descriptor indices and flag bits come from trusted generated metadata and are not revalidated on every hot-path call.

  • py: The acquired GIL token used to construct decoded Python values.
  • constructor_id: Generated TL constructor id selecting a trusted fast-path descriptor.
  • data: TL wire bytes to decode.
  • offset: Byte offset at which this constructor begins.
  • boxed: Whether data starts with and must match the constructor id.