Skip to content

miniproto.tl.fast.encode_fast

encode_fast(constructor_id: int, values: tuple[object, ...], *, boxed: bool = True) -> bytes | None

Attempt native serialization for a generated TL constructor.

Parameters:

  • constructor_id (int) – Unsigned 32-bit TL constructor identifier.
  • values (tuple[object, …]) – Constructor field values in generated-field order.
  • boxed (bool) – Whether the wire value includes its constructor identifier.

Returns:

  • bytes | None – Encoded bytes when the native fast path accepts the constructor, otherwise None.