bloqade.lanes.bytecode.encoding.KirinRustWrapper
← Module overview
class
classKirinRustWrapper¶source
bloqade.lanes.bytecode.encoding.KirinRustWrapper
Bases: RustWrapper[R], ir.Data
:class:`RustWrapper` that also satisfies Kirin's ``ir.Data`` contract.
class KirinRustWrapperUse this base for Rust types that appear as IR attributes (for example address types). Subclasses inherit:
from_inner— runs__post_init__so the Kirintypeattribute is initialised on wrappers built from existing Rust objects.unwrap— returnsself(the Python wrapper), preserving the wrapper identity through Kirin’s constprop pipeline. Kirin’spy.Constantinterpreter callsunwrap()to obtain the value to store inconst.Value; returningself._innerhere would cause the raw Rust object (without._inner) to be stored instead of the Python wrapper, breaking any downstream code that callsloc._inner.encode— delegates to the Rust object’sencodemethod (most address types implement it). Override if the Rust type does not.print_impl— prints the encoded address as a hex literal, matching the legacyEncoderformatting.
Subclasses must still define __init__ to construct self._inner
and call self.__post_init__().