pub struct BlockSerializer { /* private fields */ }Expand description
DagCbor Block Serializer/Deserializer.
Implementations§
Source§impl BlockSerializer
impl BlockSerializer
pub fn new() -> Self
pub fn new_store_params<P: StoreParams>() -> Self
pub fn new_codec(codec: impl Into<u64>) -> Self
pub fn with_codec(self, codec: impl Into<u64>) -> Self
pub fn with_max_block_size(self, max_block_size: usize) -> Self
Source§impl BlockSerializer
impl BlockSerializer
Sourcepub fn serialize<T>(&self, item: &T) -> Result<Block, BlockSerializerError>where
T: Serialize,
pub fn serialize<T>(&self, item: &T) -> Result<Block, BlockSerializerError>where
T: Serialize,
Serialize item to block.
Sourcepub fn deserialize<'a, T>(
&self,
item: &'a Block,
) -> Result<T, BlockSerializerError>where
T: Deserialize<'a>,
pub fn deserialize<'a, T>(
&self,
item: &'a Block,
) -> Result<T, BlockSerializerError>where
T: Deserialize<'a>,
Deserialize block to item.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BlockSerializer
impl RefUnwindSafe for BlockSerializer
impl Send for BlockSerializer
impl Sync for BlockSerializer
impl Unpin for BlockSerializer
impl UnsafeUnpin for BlockSerializer
impl UnwindSafe for BlockSerializer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more