Encoding

cat-encoding

Encoding and/or decoding data from one data format to another.

For general character encoding, encoding is a good choice. For JSON, serde_json is the standard. For other formats, look for crates that support them specifically. serde is the underlying engine for many of these, providing a consistent way to work with serialization.

Character Encoding

  • encoding: A comprehensive crate for working with various character encodings (UTF-8, UTF-16, Latin-1, etc.). A good general-purpose choice.
  • base64: A widely used crate for Base64 encoding and decoding.

Serialization / Deserialization (Serde)

  • serde: The powerful and widely used serialization framework in Rust. Many of the encoding crates above rely on serde. See Complex Encoding.

Structured Data (Complex Encoding)

CSV Processing

JSON Serialization

  • serde_json: A very popular crate for JSON serialization and deserialization. See JSON.

BSON (Binary JSON) Serialization

Use bson for working with BSON, a binary representation of JSON-like documents.

TOML (Tom's Obvious, Minimal Language) Serialization

Consider:

  • toml for working with TOML files - see TOML.

YAML (YAML Ain't Markup Language) Serialization

Consider:

  • serde_yml for YAML serialization and deserialization. Uses serde. See YAML.

XML Serialization

Use:

See XML.

Binary Encoders

Binary Data Serialization (General)

byteorder: For reading and writing binary data in different endianness. bincode: A crate for efficiently serializing and deserializing data in a compact binary format.

See Binary Encoders.

Binary Encoders Without External Schemas

RecipeCratesCategories
postcardpostcardcat-encoding
rkyvrkyvcat-encoding

MessagePack Serialization

Consider using rmp-serde for MessagePack serialization and deserialization. See Binary Encoders.

CBOR (Concise Binary Object Representation) Serialization

Use serde_cbor for CBOR encoding and decoding. See Binary Encoders.

Protocol Buffers

Review protobuf, prost. See Binary Encoders.

gRPC

Review tonic, grpc. See gRPC.

Typecasts

RecipeCratesCategories
bytemuckbytemuckcat-encoding
zerocopyzerocopycat-encoding