Skip to content

bloqade.lanes.bytecode.encoding.KirinRustWrapper

← Module overview

classKirinRustWrappersource

bloqade.lanes.bytecode.encoding.KirinRustWrapper

Bases: RustWrapper[R], ir.Data

:class:`RustWrapper` that also satisfies Kirin's ``ir.Data`` contract.

class KirinRustWrapper

Use this base for Rust types that appear as IR attributes (for example address types). Subclasses inherit:

  • from_inner — runs __post_init__ so the Kirin type attribute is initialised on wrappers built from existing Rust objects.
  • unwrap — returns self._inner (the Rust object), which is the natural T for ir.Data[T].
  • encode — delegates to the Rust object’s encode method (most address types implement it). Override if the Rust type does not.
  • print_impl — prints the encoded address as a hex literal, matching the legacy Encoder formatting.

Subclasses must still define __init__ to construct self._inner and call self.__post_init__().