pub trait Codec:
Copy
+ Unpin
+ Send
+ Sync
+ 'static
+ Sized
+ TryFrom<u64, Error = UnsupportedCodec>
+ Into<u64> {
// Provided methods
fn encode<T: Encode<Self> + ?Sized>(&self, obj: &T) -> Result<Vec<u8>> { ... }
fn decode<T: Decode<Self>>(&self, bytes: &[u8]) -> Result<T> { ... }
fn references<T: References<Self>, E: Extend<Cid>>(
&self,
bytes: &[u8],
set: &mut E,
) -> Result<()> { ... }
}
Expand description
Codec trait.
Provided Methods§
Sourcefn encode<T: Encode<Self> + ?Sized>(&self, obj: &T) -> Result<Vec<u8>>
fn encode<T: Encode<Self> + ?Sized>(&self, obj: &T) -> Result<Vec<u8>>
Encodes an encodable type.
Sourcefn references<T: References<Self>, E: Extend<Cid>>(
&self,
bytes: &[u8],
set: &mut E,
) -> Result<()>
fn references<T: References<Self>, E: Extend<Cid>>( &self, bytes: &[u8], set: &mut E, ) -> Result<()>
Scrapes the references.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.