跳到主要内容

Flags

搜索

结构体 Flags 

源代码
pub struct Flags(/* 私有字段 */);

实现§

源代码§

impl Flags

源代码§

impl Flags

源代码

pub const fn empty() -> Self

Get a flags value with all bits unset.

源代码

pub const fn all() -> Self

Get a flags value with all known bits set.

源代码

pub const fn bits(&self) -> c_int

Get the underlying bits value.

The returned value is exactly the bits set in this flags value.

源代码

pub const fn from_bits(bits: c_int) -> Option<Self>

Convert from a bits value.

This method will return None if any unknown bits are set.

源代码

pub const fn from_bits_truncate(bits: c_int) -> Self

Convert from a bits value, unsetting any unknown bits.

源代码

pub const fn from_bits_retain(bits: c_int) -> Self

Convert from a bits value exactly.

源代码

pub fn from_name(name: &str) -> Option<Self>

Get a flags value with the bits of a flag with the given name set.

This method will return None if name is empty or doesn’t correspond to any named flag.

源代码

pub const fn is_empty(&self) -> bool

Whether all bits in self are unset.

源代码

pub const fn is_all(&self) -> bool

Whether all known bits in this flags value are set.

源代码

pub const fn intersects(&self, other: Self) -> bool

Whether any set bits in other are also set in self.

源代码

pub const fn contains(&self, other: Self) -> bool

Whether all set bits in other are also set in self.

源代码

pub fn insert(&mut self, other: Self)

The bitwise or (|) of the bits in self and other.

源代码

pub fn remove(&mut self, other: Self)

The intersection of self with the complement of other (&!).

This method is not equivalent to self & !other when other has unknown bits set. remove won’t truncate other, but the ! operator will.

源代码

pub fn toggle(&mut self, other: Self)

The bitwise exclusive-or (^) of the bits in self and other.

源代码

pub fn set(&mut self, other: Self, value: bool)

Call insert when value is true or remove when value is false.

源代码

pub const fn intersection(self, other: Self) -> Self

The bitwise and (&) of the bits in self and other.

源代码

pub const fn union(self, other: Self) -> Self

The bitwise or (|) of the bits in self and other.

源代码

pub const fn difference(self, other: Self) -> Self

The intersection of self with the complement of other (&!).

This method is not equivalent to self & !other when other has unknown bits set. difference won’t truncate other, but the ! operator will.

源代码

pub const fn symmetric_difference(self, other: Self) -> Self

The bitwise exclusive-or (^) of the bits in self and other.

源代码

pub const fn complement(self) -> Self

The bitwise negation (!) of the bits in self, truncating the result.

源代码§

impl Flags

源代码

pub const fn iter(&self) -> Iter<Flags>

Yield a set of contained flags values.

Each yielded flags value will correspond to a defined named flag. Any unknown bits will be yielded together as a final flags value.

源代码

pub const fn iter_names(&self) -> IterNames<Flags>

Yield a set of contained named flags values.

This method is like iter, except only yields bits in contained named flags. Any unknown bits, or bits not corresponding to a contained flag will not be yielded.

trait 实现§

源代码§

impl Binary for Flags

源代码§

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

使用给定的格式化器格式化该值。 阅读更多
源代码§

impl BitAnd for Flags

源代码§

fn bitand(self, other: Self) -> Self

The bitwise and (&) of the bits in self and other.

源代码§

type Output = Flags

The resulting type after applying the & operator.
源代码§

impl BitAndAssign for Flags

源代码§

fn bitand_assign(&mut self, other: Self)

The bitwise and (&) of the bits in self and other.

源代码§

impl BitOr for Flags

源代码§

fn bitor(self, other: Flags) -> Self

The bitwise or (|) of the bits in self and other.

源代码§

type Output = Flags

The resulting type after applying the | operator.
源代码§

impl BitOrAssign for Flags

源代码§

fn bitor_assign(&mut self, other: Self)

The bitwise or (|) of the bits in self and other.

源代码§

impl BitXor for Flags

源代码§

fn bitxor(self, other: Self) -> Self

The bitwise exclusive-or (^) of the bits in self and other.

源代码§

type Output = Flags

The resulting type after applying the ^ operator.
源代码§

impl BitXorAssign for Flags

源代码§

fn bitxor_assign(&mut self, other: Self)

The bitwise exclusive-or (^) of the bits in self and other.

源代码§

impl Clone for Flags

源代码§

fn clone(&self) -> Flags

Returns a duplicate of the value. 阅读更多
1.0.0 · 源代码§

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

source 执行拷贝赋值。 阅读更多
源代码§

impl Debug for Flags

源代码§

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

使用给定的格式化器格式化该值。 阅读更多
源代码§

impl Extend<Flags> for Flags

源代码§

fn extend<T: IntoIterator<Item = Self>>(&mut self, iterator: T)

The bitwise or (|) of the bits in each flags value.

源代码§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
源代码§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. 阅读更多
源代码§

impl Flags for Flags

源代码§

const FLAGS: &'static [Flag<Flags>]

The set of defined flags.
源代码§

type Bits = i32

The underlying bits type.
源代码§

fn bits(&self) -> c_int

Get the underlying bits value. 阅读更多
源代码§

fn from_bits_retain(bits: c_int) -> Flags

Convert from a bits value exactly.
源代码§

fn all_named() -> Flags

Get a flags value with all bits from named flags set. 阅读更多
源代码§

fn empty() -> Self

Get a flags value with all bits unset.
源代码§

fn all() -> Self

Get a flags value with all known bits set.
源代码§

fn known_bits(&self) -> Self::Bits

Get the known bits from a flags value.
源代码§

fn unknown_bits(&self) -> Self::Bits

Get the unknown bits from a flags value.
源代码§

fn contains_unknown_bits(&self) -> bool

This method will return true if any unknown bits are set.
源代码§

fn from_bits(bits: Self::Bits) -> Option<Self>

Convert from a bits value. 阅读更多
源代码§

fn from_bits_truncate(bits: Self::Bits) -> Self

Convert from a bits value, unsetting any unknown bits.
源代码§

fn from_name(name: &str) -> Option<Self>

Get a flags value with the bits of a flag with the given name set. 阅读更多
源代码§

fn iter(&self) -> Iter<Self>

Yield a set of contained flags values. 阅读更多
源代码§

fn iter_names(&self) -> IterNames<Self>

Yield a set of contained named flags values. 阅读更多
源代码§

fn iter_defined_names() -> IterDefinedNames<Self>

Yield a set of all named flags defined by Self::FLAGS.
源代码§

fn iter_equal_names(&self) -> IterEqualNames<Self>

Get an iterator over all defined names for this flags value. 阅读更多
源代码§

fn is_empty(&self) -> bool

Whether all bits in this flags value are unset.
源代码§

fn is_all(&self) -> bool

Whether all known bits in this flags value are set.
源代码§

fn intersects(&self, other: Self) -> bool
where Self: Sized,

Whether any set bits in other are also set in self.
源代码§

fn contains(&self, other: Self) -> bool
where Self: Sized,

Whether all set bits in other are also set in self.
源代码§

fn truncate(&mut self)
where Self: Sized,

Remove any unknown bits from the flags.
源代码§

fn insert(&mut self, other: Self)
where Self: Sized,

The bitwise or (|) of the bits in self and other.
源代码§

fn remove(&mut self, other: Self)
where Self: Sized,

The intersection of self with the complement of other (&!). 阅读更多
源代码§

fn toggle(&mut self, other: Self)
where Self: Sized,

The bitwise exclusive-or (^) of the bits in self and other.
源代码§

fn set(&mut self, other: Self, value: bool)
where Self: Sized,

Call Flags::insert when value is true or Flags::remove when value is false.
源代码§

fn clear(&mut self)
where Self: Sized,

Unsets all bits in the flags.
源代码§

fn intersection(self, other: Self) -> Self

The bitwise and (&) of the bits in self and other.
源代码§

fn union(self, other: Self) -> Self

The bitwise or (|) of the bits in self and other.
源代码§

fn difference(self, other: Self) -> Self

The intersection of self with the complement of other (&!). 阅读更多
源代码§

fn symmetric_difference(self, other: Self) -> Self

The bitwise exclusive-or (^) of the bits in self and other.
源代码§

fn complement(self) -> Self

The bitwise negation (!) of the bits in self, truncating the result.
源代码§

impl FromIterator<Flags> for Flags

源代码§

fn from_iter<T: IntoIterator<Item = Self>>(iterator: T) -> Self

The bitwise or (|) of the bits in each flags value.

源代码§

impl IntoIterator for Flags

源代码§

type Item = Flags

被迭代的元素类型。
源代码§

type IntoIter = Iter<Flags>

我们将其转换为哪种迭代器?
源代码§

fn into_iter(self) -> Self::IntoIter

从值创建一个迭代器。 阅读更多
源代码§

impl LowerHex for Flags

源代码§

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

使用给定的格式化器格式化该值。 阅读更多
源代码§

impl Not for Flags

源代码§

fn not(self) -> Self

The bitwise negation (!) of the bits in self, truncating the result.

源代码§

type Output = Flags

The resulting type after applying the ! operator.
源代码§

impl Octal for Flags

源代码§

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

使用给定的格式化器格式化该值。 阅读更多
源代码§

impl PartialEq for Flags

源代码§

fn eq(&self, other: &Flags) -> bool

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

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

测试 !=。默认实现几乎总是足够的,没有充分理由不应被重写。
源代码§

impl PublicFlags for Flags

源代码§

type Primitive = i32

The type of the underlying storage.
源代码§

type Internal = InternalBitFlags

The type of the internal field on the generated flags type.
源代码§

impl Sub for Flags

源代码§

fn sub(self, other: Self) -> Self

The intersection of self with the complement of other (&!).

This method is not equivalent to self & !other when other has unknown bits set. difference won’t truncate other, but the ! operator will.

源代码§

type Output = Flags

The resulting type after applying the - operator.
源代码§

impl SubAssign for Flags

源代码§

fn sub_assign(&mut self, other: Self)

The intersection of self with the complement of other (&!).

This method is not equivalent to self & !other when other has unknown bits set. difference won’t truncate other, but the ! operator will.

源代码§

impl UpperHex for Flags

源代码§

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

使用给定的格式化器格式化该值。 阅读更多
源代码§

impl Copy for Flags

源代码§

impl Eq for Flags

源代码§

impl StructuralPartialEq for Flags

自动 trait 实现§

§

impl Freeze for Flags

§

impl RefUnwindSafe for Flags

§

impl Send for Flags

§

impl Sync for Flags

§

impl Unpin for Flags

§

impl UnsafeUnpin for Flags

§

impl UnwindSafe for Flags

blanket 实现§

源代码§

impl<T> Any for T
where T: 'static + ?Sized,

源代码§

fn type_id(&self) -> TypeId

获取 selfTypeId阅读更多
源代码§

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

源代码§

fn borrow(&self) -> &T

从拥有的值不可变地借用。 阅读更多
源代码§

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

源代码§

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

从拥有的值可变地借用。 阅读更多
源代码§

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

源代码§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
self 执行拷贝赋值到 dest阅读更多
源代码§

impl<T> From<T> for T

源代码§

fn from(t: T) -> T

原样返回参数。

源代码§

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

源代码§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U 实现选择执行的操作。

源代码§

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

源代码§

type Owned = T

获取所有权后得到的类型。
源代码§

fn to_owned(&self) -> T

通常通过克隆,从借用数据创建拥有的数据。 阅读更多
源代码§

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

通常通过克隆,使用借用数据替换拥有的数据。 阅读更多
源代码§

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

源代码§

type Error = Infallible

转换出错时返回的类型。
源代码§

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

执行该转换。
源代码§

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

源代码§

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

转换出错时返回的类型。
源代码§

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

执行该转换。