Module codec_registry

Module codec_registry 

Source
Expand description

Codec registry system for pluggable encoding/decoding.

This module provides a trait-based system for registering and using different codecs for IPLD data encoding/decoding. Similar to the hash registry, this allows runtime codec selection and custom codec implementations.

§Examples

use ipfrs_core::{Codec, CodecRegistry, Ipld};
use ipfrs_core::cid::codec;

// Get the global codec registry
let registry = ipfrs_core::global_codec_registry();

// Encode data with DAG-CBOR
let data = Ipld::String("Hello, IPLD!".to_string());
let encoded = registry.encode(codec::DAG_CBOR, &data).unwrap();

// Decode back
let decoded = registry.decode(codec::DAG_CBOR, &encoded).unwrap();
assert_eq!(data, decoded);

Structs§

CodecRegistry
Registry for codecs.
DagCborCodec
DAG-CBOR codec implementation.
DagJsonCodec
DAG-JSON codec implementation.
RawCodec
RAW codec implementation (no-op, stores bytes as-is).

Traits§

Codec
Trait for codec implementations.

Functions§

global_codec_registry
Get the global codec registry.