跳转到正文

bus_types API ​

完整接口目录 · 插件运行时用法 · 工具包下载

模块说明 ​

text
Native declarations and lossless scalar values for the structural Bus codec.

i8 ​

python
i8 = Annotated[int, _Width('int', 8)]

i16 ​

python
i16 = Annotated[int, _Width('int', 16)]

i32 ​

python
i32 = Annotated[int, _Width('int', 32)]

i64 ​

python
i64 = Annotated[int, _Width('int', 64)]

u8 ​

python
u8 = Annotated[int, _Width('uint', 8)]

u16 ​

python
u16 = Annotated[int, _Width('uint', 16)]

u32 ​

python
u32 = Annotated[int, _Width('uint', 32)]

u64 ​

python
u64 = Annotated[int, _Width('uint', 64)]

f32 ​

python
f32 = Annotated[float, _Width('float', 32)]

f64 ​

python
f64 = Annotated[float, _Width('float', 64)]

T ​

python
T = TypeVar('T')

OptionalValue ​

python
@dataclass
class OptionalValue(Generic[T])

SDK 说明:

text
Presence is independent of nullability: some(None) can be present.

字段(包含继承字段):

OptionalValue.present ​

python
present: bool = False

数据类字段;声明于 bus_types.OptionalValue。

OptionalValue.value ​

python
value: T | None = None

数据类字段;声明于 bus_types.OptionalValue。

OptionalValue.some ​

python
@classmethod
def some(cls, value: T) -> OptionalValue[T]

另继承外部类型 Generic[T];其通用方法不在本 SDK 目录中重复展开。

NullableValue ​

python
@dataclass
class NullableValue(Generic[T])

SDK 说明:

text
An explicitly present nullable value, including a present inner null.

Ordinary non-null payloads need no wrapper. ``NullableValue(None)`` retains
the outer presence when the schema contains two nullable layers.

字段(包含继承字段):

NullableValue.value ​

python
value: T

数据类字段;声明于 bus_types.NullableValue。

另继承外部类型 Generic[T];其通用方法不在本 SDK 目录中重复展开。

FloatBits ​

python
@dataclass(frozen=True)
class FloatBits

SDK 说明:

text
IEEE bits preserved without converting signalling NaNs through float.

字段(包含继承字段):

FloatBits.bits ​

python
bits: int

数据类字段;声明于 bus_types.FloatBits。

FloatBits.width ​

python
width: int

数据类字段;声明于 bus_types.FloatBits。

UnionValue ​

python
@dataclass
class UnionValue

SDK 说明:

text
Select a union branch explicitly when Python runtime types overlap.

``annotation`` is the declared variant (for example ``i8``), or its
canonical node ID when using a binding generated from a schema.

字段(包含继承字段):

UnionValue.annotation ​

python
annotation: Any

数据类字段;声明于 bus_types.UnionValue。

UnionValue.value ​

python
value: Any

数据类字段;声明于 bus_types.UnionValue。

NBT ​

python
@dataclass
class NBT

SDK 说明:

text
An exact NBT tag and value; List (tag 9) also retains element_type.

Integer tags use Python ints, float tags use FloatBits or float, arrays use
lists of ints, Compound uses dict[str, NBT], and List uses list[NBT].

字段(包含继承字段):

NBT.tag ​

python
tag: int

数据类字段;声明于 bus_types.NBT。

NBT.value ​

python
value: Any

数据类字段;声明于 bus_types.NBT。

NBT.element_type ​

python
element_type: int = 0

数据类字段;声明于 bus_types.NBT。

Neomega · 使用、开发与参考文档