Rust

1. Rust

1.1. Libraries

ID: 8fbe9da2-1d6a-43bc-bd89-cf448d43eab8
CREATED: <2025-03-03 Mon 15:08>

1.1.1. Serde

ID: ffb4e87c-e265-4549-91f9-093e714708c0
CREATED: <2025-02-06 Thu 18:59>
  • [2023-07-05 Wed]
    important part of the Rust ecosystem, another dtolnay contribution. If you want to program a data format in the Rust ecosystem, this is how you do it.

    The way it works is that you define some special structs, a Serializer and a Deserializer which implement the Serialize and Deserialize traits provided by serde, respectively.

    You can use these structs to provide your public API. The conventional choice is public top-level functions like from-str and to-string. That's it, your serialization library can now read and write your data format as Rust data types.

    enum-representations

    • the default behavior is an externally tagged representation (verbose)

    The docs use strings as core IO when implementing a custom format, but the convention is to implement for T where T is bound by std::io Read or Write trait. Then you can provide a more robust public API (from_bytes, from_writer, etc).

1.1.2. Dalek

ID: 79ad4134-5182-4001-b404-faeb9abd2474
CREATED: <2025-03-03 Mon 15:09>

[2025-03-03 Mon 15:09] dalek cryptography

1.2. Rust != C

ID: bb68152d-1794-47d8-86c0-03eb7f9256d7
CREATED: <2025-02-06 Thu 18:59>

Rust is not C. C is old, i.e. well-supported with a stable ABI, making the process of creating bindings for a C library a breeze in many languages.

For a Rust library we need to first appease the compiler, as explained in this section of the Rustonomicon. Among other things it involves changing the calling-convention of functions with a type signature and editing the Cargo.toml file to produce a C-compatible ABI binary. The Rust default ABI is unstable and can't reliably be used like the C ABI can.

1.4. RFCs

ID: 85f9f317-c6ef-4085-98be-db982b27a193
CREATED: <2025-03-07 Fri 21:52>

1.4.1. cargo-script

ID: 5ffb08b8-d27d-4b1f-ae05-03da0207ccdf
CREATED: <2025-03-07 Fri 22:03>

[2025-03-07 Fri 22:03] Tracking Issue for cargo-script RFC 3424

1.5. best practices