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