Struct amplify::flags::FlagVec[][src]

pub struct FlagVec(_);
Expand description

Structure holding a given set of features

Implementations

impl FlagVec[src]

pub fn new() -> FlagVec[src]

Constructs a features vector of zero feature flag set

pub fn with_capacity(upto: FlagNo) -> Self[src]

Constructs a features vector of upto feature flag in unset state

pub fn as_inner(&self) -> &[u8][src]

Returns byte slice representation of the inner data (slice of bytes, with 8 bit flags per each byte)

pub fn from_inner(slice: Vec<u8>) -> Self[src]

Constructs flag vector from inner representation (slice of bytes, with 8 bit flags per each byte)

pub fn shrunk(&self) -> Self[src]

Returns a shrunk copy of the self

pub fn iter(&self) -> AllSet<'_>

Notable traits for AllSet<'_>

impl Iterator for AllSet<'_> type Item = FlagNo;
[src]

Creates an iterator for the current feature flags which have “set” state

pub fn known_iter(&self, known: FlagVec) -> FilteredIter<'_>

Notable traits for FilteredIter<'_>

impl Iterator for FilteredIter<'_> type Item = FlagNo;
[src]

Creates iterator over known set of the features

pub fn unknown_iter(&self, known: FlagVec) -> FilteredIter<'_>

Notable traits for FilteredIter<'_>

impl Iterator for FilteredIter<'_> type Item = FlagNo;
[src]

Creates iterator over unknown set of the features, i.e. features that do not match flags set in known parameter

pub fn shrink(&mut self) -> bool[src]

Reduces the size of the internal buffer to the smallest capacity required to keep all currently set feature flags. Returns true if resize operation was required, or false otherwise, when the internal buffer already was of the smallest possible size

pub fn is_set(&self, flag_no: FlagNo) -> bool[src]

Returns whether a feature flag with flag_no is set (true or false)

pub fn set(&mut self, flag_no: FlagNo) -> bool[src]

Sets the feature flag with number flag_no. Returns true if the flag was already set and false otherwise (i.e. previous value of the flag)

pub fn unset(&mut self, flag_no: FlagNo) -> bool[src]

Unsets the feature flag with number flag_no. Returns true if the flag was set before and false otherwise (i.e. previous value of the flag)

pub fn invert(&mut self, flag_no: FlagNo)[src]

Inverts the feature flag with number flag_no

Trait Implementations

impl Binary for FlagVec[src]

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

Formats the value using the given formatter.

impl BitAnd<FlagVec> for FlagVec[src]

type Output = Self

The resulting type after applying the & operator.

fn bitand(self, rhs: Self) -> Self::Output[src]

Performs the & operation. Read more

impl BitOr<FlagVec> for FlagVec[src]

type Output = Self

The resulting type after applying the | operator.

fn bitor(self, rhs: Self) -> Self::Output[src]

Performs the | operation. Read more

impl BitXor<FlagVec> for FlagVec[src]

type Output = Self

The resulting type after applying the ^ operator.

fn bitxor(self, rhs: Self) -> Self::Output[src]

Performs the ^ operation. Read more

impl Clone for FlagVec[src]

fn clone(&self) -> FlagVec[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for FlagVec[src]

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

Formats the value using the given formatter. Read more

impl Default for FlagVec[src]

fn default() -> Self[src]

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

impl Display for FlagVec[src]

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

Formats the value using the given formatter. Read more

impl FromStr for FlagVec[src]

type Err = ParseError

The associated error which can be returned from parsing.

fn from_str(s: &str) -> Result<Self, Self::Err>[src]

Parses a string s to return a value of this type. Read more

impl Hash for FlagVec[src]

fn hash<H: Hasher>(&self, state: &mut H)[src]

Feeds this value into the given Hasher. Read more

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

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

impl LowerHex for FlagVec[src]

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

Formats the value using the given formatter.

impl Octal for FlagVec[src]

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

Formats the value using the given formatter.

impl Ord for FlagVec[src]

fn cmp(&self, other: &Self) -> Ordering[src]

This method returns an Ordering between self and other. Read more

#[must_use]
fn max(self, other: Self) -> Self
1.21.0[src]

Compares and returns the maximum of two values. Read more

#[must_use]
fn min(self, other: Self) -> Self
1.21.0[src]

Compares and returns the minimum of two values. Read more

#[must_use]
fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]

Restrict a value to a certain interval. Read more

impl PartialEq<FlagVec> for FlagVec[src]

fn eq(&self, other: &Self) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl PartialOrd<FlagVec> for FlagVec[src]

fn partial_cmp(&self, other: &Self) -> Option<Ordering>[src]

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

#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than (for self and other) and is used by the < operator. Read more

#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl TryFrom<&'_ [u8]> for FlagVec[src]

type Error = ParseError

The type returned in the event of a conversion error.

fn try_from(value: &[u8]) -> Result<Self, Self::Error>[src]

Performs the conversion.

impl TryFrom<Vec<u8, Global>> for FlagVec[src]

type Error = ParseError

The type returned in the event of a conversion error.

fn try_from(value: Vec<u8>) -> Result<Self, Self::Error>[src]

Performs the conversion.

impl UpperHex for FlagVec[src]

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

Formats the value using the given formatter.

impl Eq for FlagVec[src]

Auto Trait Implementations

impl RefUnwindSafe for FlagVec

impl Send for FlagVec

impl Sync for FlagVec

impl Unpin for FlagVec

impl UnwindSafe for FlagVec

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToHex for T where
    T: LowerHex
[src]

pub fn to_hex(&Self) -> String[src]

Outputs the hash in hexadecimal form

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

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

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

impl<T> ToString for T where
    T: Display + ?Sized
[src]

pub default fn to_string(&self) -> String[src]

Converts the given value to a String. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.