pub struct Scalar(/* private fields */);
Expand description
Representation of a single BLS12-381 scalar value.
Implementations§
source§impl Scalar
impl Scalar
sourcepub fn try_to_safe_bytes(&self) -> Option<[u8; 31]>
pub fn try_to_safe_bytes(&self) -> Option<[u8; 31]>
Convert scalar into safe bytes, returns None
if not possible to convert due to larger
internal value
sourcepub fn slice_to_repr(value: &[Self]) -> &[FsFr]
pub fn slice_to_repr(value: &[Self]) -> &[FsFr]
Convenient conversion from slice of scalar to underlying representation for efficiency purposes.
sourcepub fn slice_from_repr(value: &[FsFr]) -> &[Self]
pub fn slice_from_repr(value: &[FsFr]) -> &[Self]
Convenient conversion from slice of underlying representation to scalar for efficiency purposes.
sourcepub fn slice_option_to_repr(value: &[Option<Self>]) -> &[Option<FsFr>]
pub fn slice_option_to_repr(value: &[Option<Self>]) -> &[Option<FsFr>]
Convenient conversion from slice of optional scalar to underlying representation for efficiency purposes.
sourcepub fn slice_option_from_repr(value: &[Option<FsFr>]) -> &[Option<Self>]
pub fn slice_option_from_repr(value: &[Option<FsFr>]) -> &[Option<Self>]
Convenient conversion from slice of optional underlying representation to scalar for efficiency purposes.
sourcepub fn slice_mut_to_repr(value: &mut [Self]) -> &mut [FsFr]
pub fn slice_mut_to_repr(value: &mut [Self]) -> &mut [FsFr]
Convenient conversion from mutable slice of scalar to underlying representation for efficiency purposes.
sourcepub fn slice_mut_from_repr(value: &mut [FsFr]) -> &mut [Self]
pub fn slice_mut_from_repr(value: &mut [FsFr]) -> &mut [Self]
Convenient conversion from mutable slice of underlying representation to scalar for efficiency purposes.
sourcepub fn slice_option_mut_to_repr(
value: &mut [Option<Self>],
) -> &mut [Option<FsFr>]
pub fn slice_option_mut_to_repr( value: &mut [Option<Self>], ) -> &mut [Option<FsFr>]
Convenient conversion from optional mutable slice of scalar to underlying representation for efficiency purposes.
sourcepub fn slice_option_mut_from_repr(
value: &mut [Option<FsFr>],
) -> &mut [Option<Self>]
pub fn slice_option_mut_from_repr( value: &mut [Option<FsFr>], ) -> &mut [Option<Self>]
Convenient conversion from optional mutable slice of underlying representation to scalar for efficiency purposes.
sourcepub fn vec_to_repr(value: Vec<Self>) -> Vec<FsFr>
pub fn vec_to_repr(value: Vec<Self>) -> Vec<FsFr>
Convenient conversion from vector of scalar to underlying representation for efficiency purposes.
sourcepub fn vec_from_repr(value: Vec<FsFr>) -> Vec<Self>
pub fn vec_from_repr(value: Vec<FsFr>) -> Vec<Self>
Convenient conversion from vector of underlying representation to scalar for efficiency purposes.
Trait Implementations§
impl Copy for Scalar
impl Eq for Scalar
impl StructuralPartialEq for Scalar
Auto Trait Implementations§
impl Freeze for Scalar
impl RefUnwindSafe for Scalar
impl Send for Scalar
impl Sync for Scalar
impl Unpin for Scalar
impl UnwindSafe for Scalar
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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