codec/postcard.rs

fuel-core · crates/storage/src/codec/postcard.rs · rust · Apache-2.0
database

Generic Postcard codec for serde types.

// Source: https://github.com/FuelLabs/fuel-core | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
//! The module contains the implementation of the `Postcard` codec.
//! Any type that implements `serde::Serialize` and `serde::Deserialize`
//! can use the `Postcard` codec to be encoded/decoded into/from bytes.
//! The `serde` serialization and deserialization add their own overhead,
//! so this codec shouldn't be used for simple types.

use crate::codec::{
    Decode,
    Encode,
};

#[cfg(feature = "std")]
use std::borrow::Cow;

#[cfg(not(feature = "std"))]
use alloc::borrow::Cow;

/// The codec is used to serialized/deserialized types that supports `serde::Serialize` and `serde::D

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key