mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-12 10:03:51 +00:00
* Add craft-kiwi: the kiwi binary schema format, decoded and encoded The generic kiwi decoder and encoder from FigCraft's .fig import and export (crates/format/src/fig/kiwi.rs at 3b9bf8c9), moved as it is: binary schema decode and encode, the compact text form of a schema, message decode into a tree keyed by field name, and message encode checked against the schema. The value budget that follows a .fig file's compressed size stays with the .fig reader; here decode_message_within takes the budget and DEFAULT_MAX_VALUES is the floor FigCraft used. * Add craft-fig: the .fig container, read and written The app-independent half of FigCraft's .fig import and export (crates/format/src/fig at 3b9bf8c9): the ZIP archive with its image budget, the chunked canvas (deflate, zlib and zstd chunks), the value budget that follows the compressed canvas, images carried in the message's blobs, and the vector network and geometry blob encodings. The message stays a craft-kiwi tree read by field name; mapping it onto a document stays in the app. * craft-kiwi: no scan per field in schema decode; the text form keeps the limits Schema::decode compared each message field id with every earlier one: 20 definitions of 10 000 fields, within every cap, took a billion comparisons. A set per definition now. Schema::parse applies the definition and field caps of the binary form, looks type names up in an index instead of scanning the lines per field, accepts a struct or message without fields, and refuses two fields of one name and a message field id that is 0 (it ends a message) or repeated.
23 lines
1.0 KiB
TOML
23 lines
1.0 KiB
TOML
[package]
|
|
name = "craft-fig"
|
|
description = "Clean-room reader and writer for the .fig container (Figma Design and FigJam local copies): the ZIP archive, the chunked canvas with its kiwi schema and message, images, vector network and geometry blobs, with bounded reads."
|
|
version.workspace = true
|
|
edition.workspace = true
|
|
license.workspace = true
|
|
rust-version.workspace = true
|
|
repository.workspace = true
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[dependencies]
|
|
craft-kiwi = { workspace = true }
|
|
serde_json = { workspace = true }
|
|
thiserror = { workspace = true }
|
|
# `deflate-flate2` with flate2's default miniz_oxide backend, as craft-update pins it (zip's own
|
|
# `deflate` feature would switch a whole app's flate2 to zlib-rs). A shared bounded ZIP reader is
|
|
# planned (#126); until it lands this crate reads through `zip` directly.
|
|
zip = { version = "9", default-features = false, features = ["deflate-flate2"] }
|
|
flate2 = { version = "1", default-features = false, features = ["rust_backend"] }
|
|
ruzstd = { version = "0.9", default-features = false, features = ["std"] }
|