Skip to content

kiwi

Decoding of the Kiwi binary format, Evan Wallace’s schema-based serialization (used by Figma’s .fig files, but generic).

A Kiwi message is meaningless without its schema. Schema::parse reads a binary schema (the compiled form Kiwi writes, which .fig files embed), then Schema::decode decodes a message against one of its definitions into a dynamic Value tree: objects, arrays, enums by name and the usual scalars. Every failure on truncated or invalid data is a precise KiwiError.

Built on bytes::ByteReader, plus Kiwi’s own 64-bit varints and floats, which are not LEB128 and IEEE 754 on the wire.

Cargo feature kiwi (enabled by default). To compile only this module:

cargo add helpers4 --no-default-features --features kiwi

or in Cargo.toml:

[dependencies]
helpers4 = { version = "0.0.11", default-features = false, features = ["kiwi"] }

Import path: helpers4::kiwi.

ItemWhat it does
DefinitionA named enum, struct or message of a Kiwi schema.
FieldOne field of a Definition.
FieldTypeThe type of a Field: one of Kiwi’s built-in types, or another definition of the schema.
KindWhat a Definition is: an enum, a struct (all its fields, in order) or a message (any of its fields, each with an id, ended by a 0).
SchemaA Kiwi schema: the definitions (enums, structs and messages) that give meaning to the bytes of a message.
ValueA decoded Kiwi value.

Documented on the page of the helper that returns them.

TypeReturned by
KiwiErrorSchema