pub struct ScalarBytes(/* private fields */);Expand description
Single BLS12-381 scalar with big-endian representation, not guaranteed to be valid
Implementations§
Source§impl ScalarBytes
 
impl ScalarBytes
Sourcepub const SAFE_BYTES: usize = 31usize
 
pub const SAFE_BYTES: usize = 31usize
How many full bytes can be stored in BLS12-381 scalar (for instance before encoding). It is actually 254 bits, but bits are mut harder to work with and likely not worth it.
NOTE: After encoding more bytes can be used, so don’t rely on this as the max number of bytes stored within at all times!
Sourcepub const FULL_BYTES: usize = 32usize
 
pub const FULL_BYTES: usize = 32usize
How many bytes Scalar contains physically, use Self::SAFE_BYTES for the amount of data
that you can put into it safely (for instance before encoding).
Trait Implementations§
Source§impl Clone for ScalarBytes
 
impl Clone for ScalarBytes
Source§fn clone(&self) -> ScalarBytes
 
fn clone(&self) -> ScalarBytes
Returns a copy 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 Debug for ScalarBytes
 
impl Debug for ScalarBytes
Source§impl Decode for ScalarBytes
 
impl Decode for ScalarBytes
Source§fn decode<__CodecInputEdqy: Input>(
    __codec_input_edqy: &mut __CodecInputEdqy,
) -> Result<Self, Error>
 
fn decode<__CodecInputEdqy: Input>( __codec_input_edqy: &mut __CodecInputEdqy, ) -> Result<Self, Error>
Attempt to deserialise the value from input.
§fn decode_into<I>(
    input: &mut I,
    dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
    I: Input,
 
fn decode_into<I>(
    input: &mut I,
    dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
    I: Input,
Attempt to deserialize the value from input into a pre-allocated piece of memory. Read more
§fn skip<I>(input: &mut I) -> Result<(), Error>where
    I: Input,
 
fn skip<I>(input: &mut I) -> Result<(), Error>where
    I: Input,
Attempt to skip the encoded value from input. Read more
§fn encoded_fixed_size() -> Option<usize>
 
fn encoded_fixed_size() -> Option<usize>
Returns the fixed encoded size of the type. Read more
Source§impl Default for ScalarBytes
 
impl Default for ScalarBytes
Source§fn default() -> ScalarBytes
 
fn default() -> ScalarBytes
Returns the “default value” for a type. Read more
Source§impl Deref for ScalarBytes
 
impl Deref for ScalarBytes
Source§impl DerefMut for ScalarBytes
 
impl DerefMut for ScalarBytes
Source§impl<'de> Deserialize<'de> for ScalarBytes
 
impl<'de> Deserialize<'de> for ScalarBytes
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
    __D: Deserializer<'de>,
 
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
    __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Encode for ScalarBytes
 
impl Encode for ScalarBytes
Source§fn size_hint(&self) -> usize
 
fn size_hint(&self) -> usize
If possible give a hint of expected size of the encoding. Read more
Source§fn encode_to<__CodecOutputEdqy: Output + ?Sized>(
    &self,
    __codec_dest_edqy: &mut __CodecOutputEdqy,
)
 
fn encode_to<__CodecOutputEdqy: Output + ?Sized>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy, )
Convert self to a slice and append it to the destination.
Source§fn using_encoded<__CodecOutputReturn, __CodecUsingEncodedCallback: FnOnce(&[u8]) -> __CodecOutputReturn>(
    &self,
    f: __CodecUsingEncodedCallback,
) -> __CodecOutputReturn
 
fn using_encoded<__CodecOutputReturn, __CodecUsingEncodedCallback: FnOnce(&[u8]) -> __CodecOutputReturn>( &self, f: __CodecUsingEncodedCallback, ) -> __CodecOutputReturn
Convert self to a slice and then invoke the given closure with it.
§fn encoded_size(&self) -> usize
 
fn encoded_size(&self) -> usize
Calculates the encoded size. Read more
Source§impl From<ScalarBytes> for [u8; 32]
 
impl From<ScalarBytes> for [u8; 32]
Source§fn from(value: ScalarBytes) -> Self
 
fn from(value: ScalarBytes) -> Self
Converts to this type from the input type.
Source§impl Hash for ScalarBytes
 
impl Hash for ScalarBytes
Source§impl Ord for ScalarBytes
 
impl Ord for ScalarBytes
Source§fn cmp(&self, other: &ScalarBytes) -> Ordering
 
fn cmp(&self, other: &ScalarBytes) -> 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 PartialEq for ScalarBytes
 
impl PartialEq for ScalarBytes
Source§impl PartialOrd for ScalarBytes
 
impl PartialOrd for ScalarBytes
Source§impl Serialize for ScalarBytes
 
impl Serialize for ScalarBytes
Source§impl TypeInfo for ScalarBytes
 
impl TypeInfo for ScalarBytes
impl Copy for ScalarBytes
impl EncodeLike for ScalarBytes
impl Eq for ScalarBytes
impl StructuralPartialEq for ScalarBytes
Auto Trait Implementations§
impl Freeze for ScalarBytes
impl RefUnwindSafe for ScalarBytes
impl Send for ScalarBytes
impl Sync for ScalarBytes
impl Unpin for ScalarBytes
impl UnwindSafe for ScalarBytes
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> CloneToUninit for Twhere
    T: Clone,
 
impl<T> CloneToUninit for Twhere
    T: Clone,
§impl<T> DecodeAll for Twhere
    T: Decode,
 
impl<T> DecodeAll for Twhere
    T: Decode,
§fn decode_all(input: &mut &[u8]) -> Result<T, Error>
 
fn decode_all(input: &mut &[u8]) -> Result<T, Error>
Decode 
Self and consume all of the given input data. Read more§impl<T> DecodeLimit for Twhere
    T: Decode,
 
impl<T> DecodeLimit for Twhere
    T: Decode,
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