pub struct CompressedChecked<T>(pub T);Expand description
A serde-compatible wrapper that forces compression and validates.
Tuple Fields§
§0: TTrait Implementations§
Source§impl<T: CanonicalDeserialize> CanonicalDeserialize for CompressedChecked<T>
impl<T: CanonicalDeserialize> CanonicalDeserialize for CompressedChecked<T>
Source§fn deserialize_with_mode<R: Read>(
reader: R,
_compress: Compress,
_validate: Validate,
) -> Result<Self, SerializationError>
fn deserialize_with_mode<R: Read>( reader: R, _compress: Compress, _validate: Validate, ) -> Result<Self, SerializationError>
The general deserialize method that takes in customization flags.
Source§fn deserialize_compressed<R: Read>(
reader: R,
) -> Result<Self, SerializationError>
fn deserialize_compressed<R: Read>( reader: R, ) -> Result<Self, SerializationError>
Reads
Self from reader using the compressed form if applicable.
Performs validation if applicable.Source§fn deserialize_compressed_unchecked<R: Read>(
reader: R,
) -> Result<Self, SerializationError>
fn deserialize_compressed_unchecked<R: Read>( reader: R, ) -> Result<Self, SerializationError>
Reads
Self from reader using the compressed form if applicable, without validating the
deserialized value. Read moreSource§fn deserialize_uncompressed<R: Read>(
reader: R,
) -> Result<Self, SerializationError>
fn deserialize_uncompressed<R: Read>( reader: R, ) -> Result<Self, SerializationError>
Reads
Self from reader using the uncompressed form. Performs validation if applicable.Source§fn deserialize_uncompressed_unchecked<R: Read>(
reader: R,
) -> Result<Self, SerializationError>
fn deserialize_uncompressed_unchecked<R: Read>( reader: R, ) -> Result<Self, SerializationError>
Reads
Self from reader using the uncompressed form, without validating the deserialized
value. Read moreSource§impl<T: CanonicalSerialize> CanonicalSerialize for CompressedChecked<T>
impl<T: CanonicalSerialize> CanonicalSerialize for CompressedChecked<T>
Source§fn serialize_with_mode<W: Write>(
&self,
writer: W,
_compress: Compress,
) -> Result<(), SerializationError>
fn serialize_with_mode<W: Write>( &self, writer: W, _compress: Compress, ) -> Result<(), SerializationError>
The general serialize method that takes in customization flags.
Source§fn serialized_size(&self, _compress: Compress) -> usize
fn serialized_size(&self, _compress: Compress) -> usize
Returns the size in bytes of the serialized version of
self with the given compression mode.Source§fn serialize_compressed<W: Write>(
&self,
writer: W,
) -> Result<(), SerializationError>
fn serialize_compressed<W: Write>( &self, writer: W, ) -> Result<(), SerializationError>
Serializes
self into writer using the compressed form if applicable.Source§fn compressed_size(&self) -> usize
fn compressed_size(&self) -> usize
Returns the size in bytes of the compressed serialized version of
self.Source§fn serialize_uncompressed<W: Write>(
&self,
writer: W,
) -> Result<(), SerializationError>
fn serialize_uncompressed<W: Write>( &self, writer: W, ) -> Result<(), SerializationError>
Serializes
self into writer using the uncompressed form.Source§fn uncompressed_size(&self) -> usize
fn uncompressed_size(&self) -> usize
Returns the size in bytes of the uncompressed serialized version of
self.Source§impl<T: Clone> Clone for CompressedChecked<T>
impl<T: Clone> Clone for CompressedChecked<T>
Source§fn clone(&self) -> CompressedChecked<T>
fn clone(&self) -> CompressedChecked<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: Debug> Debug for CompressedChecked<T>
impl<T: Debug> Debug for CompressedChecked<T>
Source§impl<T: Default> Default for CompressedChecked<T>
impl<T: Default> Default for CompressedChecked<T>
Source§fn default() -> CompressedChecked<T>
fn default() -> CompressedChecked<T>
Returns the “default value” for a type. Read more
Source§impl<T> Deref for CompressedChecked<T>
impl<T> Deref for CompressedChecked<T>
Source§impl<T> DerefMut for CompressedChecked<T>
impl<T> DerefMut for CompressedChecked<T>
Source§impl<T> From<T> for CompressedChecked<T>
impl<T> From<T> for CompressedChecked<T>
Source§fn from(value: T) -> CompressedChecked<T>
fn from(value: T) -> CompressedChecked<T>
Converts to this type from the input type.
Source§impl<T: Hash> Hash for CompressedChecked<T>
impl<T: Hash> Hash for CompressedChecked<T>
Source§impl<T: Ord> Ord for CompressedChecked<T>
impl<T: Ord> Ord for CompressedChecked<T>
Source§fn cmp(&self, other: &CompressedChecked<T>) -> Ordering
fn cmp(&self, other: &CompressedChecked<T>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<T: PartialEq> PartialEq for CompressedChecked<T>
impl<T: PartialEq> PartialEq for CompressedChecked<T>
Source§impl<T: PartialOrd> PartialOrd for CompressedChecked<T>
impl<T: PartialOrd> PartialOrd for CompressedChecked<T>
Source§impl<T: Valid> Valid for CompressedChecked<T>
impl<T: Valid> Valid for CompressedChecked<T>
Source§fn check(&self) -> Result<(), SerializationError>
fn check(&self) -> Result<(), SerializationError>
Checks whether
self is valid. If self is valid, returns Ok(()). Otherwise, returns
an error describing the failure.
This method is called by deserialize_with_mode if validate is Validate::Yes.Source§const TRIVIAL_CHECK: bool = false
const TRIVIAL_CHECK: bool = false
Whether the
check method is trivial (i.e. always returns Ok(())). If this is true,
the batch_check method will skip all checks and return Ok(()).
This should be set to true for types where check is trivial, e.g.
integers, field elements, etc.
This is false by default.
This is primarily an optimization to skip unnecessary checks in batch_check.Source§fn batch_check<'a>(
batch: impl Iterator<Item = &'a Self> + Send,
) -> Result<(), SerializationError>where
Self: 'a,
fn batch_check<'a>(
batch: impl Iterator<Item = &'a Self> + Send,
) -> Result<(), SerializationError>where
Self: 'a,
Checks whether all items in
batch are valid. If all items are valid, returns Ok(()).
Otherwise, returns an error describing the first failure.impl<T: Copy> Copy for CompressedChecked<T>
impl<T: Eq> Eq for CompressedChecked<T>
impl<T> StructuralPartialEq for CompressedChecked<T>
Auto Trait Implementations§
impl<T> Freeze for CompressedChecked<T>where
T: Freeze,
impl<T> RefUnwindSafe for CompressedChecked<T>where
T: RefUnwindSafe,
impl<T> Send for CompressedChecked<T>where
T: Send,
impl<T> Sync for CompressedChecked<T>where
T: Sync,
impl<T> Unpin for CompressedChecked<T>where
T: Unpin,
impl<T> UnsafeUnpin for CompressedChecked<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for CompressedChecked<T>where
T: UnwindSafe,
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