Skip to main content

CompressedChecked

Struct CompressedChecked 

Source
pub struct CompressedChecked<T>(pub T);
Expand description

A serde-compatible wrapper that forces compression and validates.

Tuple Fields§

§0: T

Trait Implementations§

Source§

impl<T: CanonicalDeserialize> CanonicalDeserialize for CompressedChecked<T>

Source§

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>

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>

Reads Self from reader using the compressed form if applicable, without validating the deserialized value. Read more
Source§

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>

Reads Self from reader using the uncompressed form, without validating the deserialized value. Read more
Source§

impl<T: CanonicalSerialize> CanonicalSerialize for CompressedChecked<T>

Source§

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

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>

Serializes self into writer using the compressed form if applicable.
Source§

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>

Serializes self into writer using the uncompressed form.
Source§

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>

Source§

fn clone(&self) -> CompressedChecked<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for CompressedChecked<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Default> Default for CompressedChecked<T>

Source§

fn default() -> CompressedChecked<T>

Returns the “default value” for a type. Read more
Source§

impl<T> Deref for CompressedChecked<T>

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<T> DerefMut for CompressedChecked<T>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<T> From<T> for CompressedChecked<T>

Source§

fn from(value: T) -> CompressedChecked<T>

Converts to this type from the input type.
Source§

impl<T: Hash> Hash for CompressedChecked<T>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T: Ord> Ord for CompressedChecked<T>

Source§

fn cmp(&self, other: &CompressedChecked<T>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<T: PartialEq> PartialEq for CompressedChecked<T>

Source§

fn eq(&self, other: &CompressedChecked<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: PartialOrd> PartialOrd for CompressedChecked<T>

Source§

fn partial_cmp(&self, other: &CompressedChecked<T>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<T: Valid> Valid for CompressedChecked<T>

Source§

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

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,

Checks whether all items in batch are valid. If all items are valid, returns Ok(()). Otherwise, returns an error describing the first failure.
Source§

impl<T: Copy> Copy for CompressedChecked<T>

Source§

impl<T: Eq> Eq for CompressedChecked<T>

Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CanonicalSerializeHashExt for T

Source§

fn hash<H: Digest>(&self) -> Output<H>

Source§

fn hash_uncompressed<H: Digest>(&self) -> Output<H>

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<!> for T

Source§

fn from(t: !) -> T

Converts to this type from the input type.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V