MCPcopy Create free account
hub / github.com/bitflags/bitflags / from_bits

Method from_bits

src/traits.rs:190–198  ·  view source on GitHub ↗

Convert from a bits value. This method will return `None` if any unknown bits are set.

(bits: Self::Bits)

Source from the content-addressed store, hash-verified

188 ///
189 /// This method will return `None` if any unknown bits are set.
190 fn from_bits(bits: Self::Bits) -> Option<Self> {
191 let truncated = Self::from_bits_truncate(bits);
192
193 if truncated.bits() == bits {
194 Some(truncated)
195 } else {
196 None
197 }
198 }
199
200 /// Convert from a bits value, unsetting any unknown bits.
201 fn from_bits_truncate(bits: Self::Bits) -> Self {

Callers

nothing calls this directly

Implementers 2

macro_free.rsexamples/macro_free.rs
custom_bits_type.rsexamples/custom_bits_type.rs

Calls 1

bitsMethod · 0.45

Tested by

no test coverage detected