pub enum SWFlags {
YIsPositive = 0,
PointAtInfinity = 64,
YIsNegative = 128,
}Expand description
Flags to be encoded into the serialization. The default flags (empty) should not change the binary representation.
Variants§
YIsPositive = 0
Represents a point with positive y-coordinate by setting all bits to 0.
PointAtInfinity = 64
Represents the point at infinity by setting the setting the last-but-one bit to 1.
YIsNegative = 128
Represents a point with negative y-coordinate by setting the MSB to 1.
Implementations§
Source§impl SWFlags
impl SWFlags
pub const fn infinity() -> Self
pub fn from_y_coordinate(y: impl Field) -> Self
pub const fn is_infinity(&self) -> bool
pub const fn is_positive(&self) -> Option<bool>
Trait Implementations§
Source§impl Flags for SWFlags
impl Flags for SWFlags
Source§const BIT_SIZE: usize = 2
const BIT_SIZE: usize = 2
The number of bits required to encode
Self.
This should be at most 8.Source§fn u8_bitmask(&self) -> u8
fn u8_bitmask(&self) -> u8
Returns a bit mask corresponding to
self.
For example, if Self contains two variants, there are just two possible
bit masks: 0 and 1 << 7.Source§fn from_u8(value: u8) -> Option<Self>
fn from_u8(value: u8) -> Option<Self>
Tries to read
Self from value. Should return None if the
Self::BIT_SIZE most-significant bits of value do not correspond to
those generated by u8_bitmask. Read moreSource§fn from_u8_remove_flags(value: &mut u8) -> Option<Self>
fn from_u8_remove_flags(value: &mut u8) -> Option<Self>
Convenience method that reads
Self from value, just like Self::from_u8,
but additionally zeroes out the bits corresponding to the resulting flag
in value. If Self::from_u8(*value) would return None, then this
method should not modify value.impl Copy for SWFlags
impl Eq for SWFlags
impl StructuralPartialEq for SWFlags
Auto Trait Implementations§
impl Freeze for SWFlags
impl RefUnwindSafe for SWFlags
impl Send for SWFlags
impl Sync for SWFlags
impl Unpin for SWFlags
impl UnsafeUnpin for SWFlags
impl UnwindSafe for SWFlags
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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