pub struct CompressedUnchecked<T>(pub T);Expand description
A serde-compatible wrapper that forces compression and skips validation.
Tuple Fields§
§0: TTrait Implementations§
Source§impl<T: CanonicalDeserialize> CanonicalDeserialize for CompressedUnchecked<T>
impl<T: CanonicalDeserialize> CanonicalDeserialize for CompressedUnchecked<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 CompressedUnchecked<T>
impl<T: CanonicalSerialize> CanonicalSerialize for CompressedUnchecked<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 CompressedUnchecked<T>
impl<T: Clone> Clone for CompressedUnchecked<T>
Source§fn clone(&self) -> CompressedUnchecked<T>
fn clone(&self) -> CompressedUnchecked<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 CompressedUnchecked<T>
impl<T: Debug> Debug for CompressedUnchecked<T>
Source§impl<T: Default> Default for CompressedUnchecked<T>
impl<T: Default> Default for CompressedUnchecked<T>
Source§fn default() -> CompressedUnchecked<T>
fn default() -> CompressedUnchecked<T>
Returns the “default value” for a type. Read more
Source§impl<T> Deref for CompressedUnchecked<T>
impl<T> Deref for CompressedUnchecked<T>
Source§impl<T> DerefMut for CompressedUnchecked<T>
impl<T> DerefMut for CompressedUnchecked<T>
Source§impl<T> From<T> for CompressedUnchecked<T>
impl<T> From<T> for CompressedUnchecked<T>
Source§fn from(value: T) -> CompressedUnchecked<T>
fn from(value: T) -> CompressedUnchecked<T>
Converts to this type from the input type.
Source§impl<T: Hash> Hash for CompressedUnchecked<T>
impl<T: Hash> Hash for CompressedUnchecked<T>
Source§impl<T: Ord> Ord for CompressedUnchecked<T>
impl<T: Ord> Ord for CompressedUnchecked<T>
Source§fn cmp(&self, other: &CompressedUnchecked<T>) -> Ordering
fn cmp(&self, other: &CompressedUnchecked<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 CompressedUnchecked<T>
impl<T: PartialEq> PartialEq for CompressedUnchecked<T>
Source§impl<T: PartialOrd> PartialOrd for CompressedUnchecked<T>
impl<T: PartialOrd> PartialOrd for CompressedUnchecked<T>
Source§impl<T: Valid> Valid for CompressedUnchecked<T>
impl<T: Valid> Valid for CompressedUnchecked<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 CompressedUnchecked<T>
impl<T: Eq> Eq for CompressedUnchecked<T>
impl<T> StructuralPartialEq for CompressedUnchecked<T>
Auto Trait Implementations§
impl<T> Freeze for CompressedUnchecked<T>where
T: Freeze,
impl<T> RefUnwindSafe for CompressedUnchecked<T>where
T: RefUnwindSafe,
impl<T> Send for CompressedUnchecked<T>where
T: Send,
impl<T> Sync for CompressedUnchecked<T>where
T: Sync,
impl<T> Unpin for CompressedUnchecked<T>where
T: Unpin,
impl<T> UnsafeUnpin for CompressedUnchecked<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for CompressedUnchecked<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