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<ByteCursor, String> { ... }
fn decode<T: Decode<Self>>(&self, bytes: ByteCursor) -> Result<T, String> { ... }
fn references<T: References<Self>, E: Extend<Cid>>(
&self,
bytes: ByteCursor,
set: &mut E,
) -> Result<(), String> { ... }
}Provided Methods§
Sourcefn encode<T: Encode<Self> + ?Sized>(
&self,
obj: &T,
) -> Result<ByteCursor, String>
fn encode<T: Encode<Self> + ?Sized>( &self, obj: &T, ) -> Result<ByteCursor, String>
§Errors
Will return Err if there was a problem encoding the object into a
ByteCursor
Sourcefn decode<T: Decode<Self>>(&self, bytes: ByteCursor) -> Result<T, String>
fn decode<T: Decode<Self>>(&self, bytes: ByteCursor) -> Result<T, String>
§Errors
Will return Err if there was a problem decoding the ByteCursor into an
object
Sourcefn references<T: References<Self>, E: Extend<Cid>>(
&self,
bytes: ByteCursor,
set: &mut E,
) -> Result<(), String>
fn references<T: References<Self>, E: Extend<Cid>>( &self, bytes: ByteCursor, set: &mut E, ) -> Result<(), String>
Extends set with any cids the type encoded in the bytecursor
refers to.
§Errors
Returns Err if there were any errors decoding the bytecursor.
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.