21 releases

0.8.0 Mar 19, 2024
0.8.0-alpha Jul 29, 2021
0.7.5 Feb 28, 2023
0.7.3 Jan 24, 2022
0.0.4 Jul 30, 2019

#134 in Encoding

Download history 1945/week @ 2024-03-14 1783/week @ 2024-03-21 1968/week @ 2024-03-28 1420/week @ 2024-04-04 1611/week @ 2024-04-11 1768/week @ 2024-04-18 1734/week @ 2024-04-25 1192/week @ 2024-05-02 1612/week @ 2024-05-09 1151/week @ 2024-05-16 979/week @ 2024-05-23 1089/week @ 2024-05-30 1203/week @ 2024-06-06 1503/week @ 2024-06-13 2020/week @ 2024-06-20 1262/week @ 2024-06-27

6,178 downloads per month
Used in 100 crates (14 directly)

MIT license

13KB
354 lines

Molecule

License GitHub Actions

Another serialization system: minimalist and canonicalization.

Documents

Features

  • default — Default features: std, utilizes faster-hex for hexadecimal operations and enables bytes standard features.
  • std (enabled by default) — Default features: std, utilizes faster-hex for hexadecimal operations and enables bytes standard features.
  • bytes_vec - Introduced in version 0.8, the 0.8 molecule defaults to bytes, which has implications for use in the CKB runtime. The bytes_vec feature provides users with a compatibility option to maintain consistency with previous versions.

Use in CKB scripts

When used in CKB scripts, no-std needs to be specified.

molecule = { version = "0.7", default-features = false }

Particularly, for versions later than 0.8, you need to additionally specify the bytes_vec feature.

molecule = { version = "0.8.0", default-features = false, features = ["bytes_vec"] }

Tools

Schema Compiler and Code Generator

Install

The official schema compiler and code generator are written in Rust, so you can install it via Cargo:

cargo install moleculec --locked

Note: the official code generator is only support two languages: Rust and C.

Usage

  • You can use the follow command to generate the code:

    moleculec --language <language> --schema-file <schema-file>
    
  • More details can be found by the follow command:

    moleculec --help
    

Other Languages

Molecule's reference implementation is in Rust and C.

Implementations in other languages are maintained by respective authors.

Plugins for Editors

Benchmark

Supported Rust Versions

The minimum supported version is 1.56.1. The current Molecule version is not guaranteed to build on Rust versions earlier than the minimum supported version.

License

Licensed under MIT License.

Dependencies

~190KB