Struct test_setup::BitFlags

source ·
pub struct BitFlags<T, N = <T as RawBitFlags>::Numeric> { /* private fields */ }
Expand description

Represents a set of flags of some type T. T must have the #[bitflags] attribute applied.

A BitFlags<T> is as large as the T itself, and stores one flag per bit.

Memory layout

BitFlags<T> is marked with the #[repr(transparent)] trait, meaning it can be safely transmuted into the corresponding numeric type.

Usually, the same can be achieved by using BitFlags::from_bits, BitFlags::from_bits_truncate or BitFlags::from_bits_unchecked, but transmuting might still be useful if, for example, you’re dealing with an entire array of BitFlags.

Transmuting from a numeric type into BitFlags may also be done, but care must be taken to make sure that each set bit in the value corresponds to an existing flag (cf. from_bits_unchecked).

For example:

#[bitflags]
#[repr(u8)] // <-- the repr determines the numeric type
#[derive(Copy, Clone)]
enum TransmuteMe {
    One = 1 << 0,
    Two = 1 << 1,
}

// NOTE: we use a small, self-contained function to handle the slice
// conversion to make sure the lifetimes are right.
fn transmute_slice<'a>(input: &'a [BitFlags<TransmuteMe>]) -> &'a [u8] {
    unsafe {
        slice::from_raw_parts(input.as_ptr() as *const u8, input.len())
    }
}

let many_flags = &[
    TransmuteMe::One.into(),
    TransmuteMe::One | TransmuteMe::Two,
];

let as_nums = transmute_slice(many_flags);
assert_eq!(as_nums, &[0b01, 0b11]);

Implementation notes

You might expect this struct to be defined as

struct BitFlags<T: BitFlag> {
    value: T::Numeric
}

Ideally, that would be the case. However, because const fns cannot have trait bounds in current Rust, this would prevent us from providing most const fn APIs. As a workaround, we define BitFlags with two type parameters, with a default for the second one:

struct BitFlags<T, N = <T as BitFlag>::Numeric> {
    value: N,
    marker: PhantomData<T>,
}

The types substituted for T and N must always match, creating a BitFlags value where that isn’t the case is only possible with incorrect unsafe code.

Implementations§

source§

impl<T> BitFlags<T>where T: BitFlag,

source

pub fn from_bits( bits: <T as RawBitFlags>::Numeric ) -> Result<BitFlags<T>, FromBitsError<T>>

Returns a BitFlags<T> if the raw value provided does not contain any illegal flags.

source

pub fn from_bits_truncate(bits: <T as RawBitFlags>::Numeric) -> BitFlags<T>

Create a BitFlags<T> from an underlying bitwise value. If any invalid bits are set, ignore them.

source

pub unsafe fn from_bits_unchecked( val: <T as RawBitFlags>::Numeric ) -> BitFlags<T>

Create a new BitFlags unsafely, without checking if the bits form a valid bit pattern for the type.

Consider using from_bits or from_bits_truncate instead.

Safety

All bits set in val must correspond to a value of the enum.

source

pub fn from_flag(flag: T) -> BitFlags<T>

Turn a T into a BitFlags<T>. Also available as flag.into().

source

pub fn empty() -> BitFlags<T>

Create a BitFlags with no flags set (in other words, with a value of 0).

See also: BitFlag::empty, a convenience reexport; BitFlags::EMPTY, the same functionality available as a constant for const fn code.

#[bitflags]
#[repr(u8)]
#[derive(Clone, Copy, PartialEq, Eq)]
enum MyFlag {
    One = 1 << 0,
    Two = 1 << 1,
    Three = 1 << 2,
}

let empty: BitFlags<MyFlag> = BitFlags::empty();
assert!(empty.is_empty());
assert_eq!(empty.contains(MyFlag::One), false);
assert_eq!(empty.contains(MyFlag::Two), false);
assert_eq!(empty.contains(MyFlag::Three), false);
source

pub fn all() -> BitFlags<T>

Create a BitFlags with all flags set.

See also: BitFlag::all, a convenience reexport; BitFlags::ALL, the same functionality available as a constant for const fn code.

#[bitflags]
#[repr(u8)]
#[derive(Clone, Copy, PartialEq, Eq)]
enum MyFlag {
    One = 1 << 0,
    Two = 1 << 1,
    Three = 1 << 2,
}

let empty: BitFlags<MyFlag> = BitFlags::all();
assert!(empty.is_all());
assert_eq!(empty.contains(MyFlag::One), true);
assert_eq!(empty.contains(MyFlag::Two), true);
assert_eq!(empty.contains(MyFlag::Three), true);
source

pub const EMPTY: BitFlags<T> = _

An empty BitFlags. Equivalent to empty(), but works in a const context.

source

pub const ALL: BitFlags<T> = _

A BitFlags with all flags set. Equivalent to all(), but works in a const context.

source

pub const CONST_TOKEN: ConstToken<T, <T as RawBitFlags>::Numeric> = _

A ConstToken for this type of flag.

source

pub fn is_all(self) -> bool

Returns true if all flags are set

source

pub fn is_empty(self) -> bool

Returns true if no flag is set

source

pub fn len(self) -> usize

Returns the number of flags set.

source

pub fn exactly_one(self) -> Option<T>

If exactly one flag is set, the flag is returned. Otherwise, returns None.

See also Itertools::exactly_one.

source

pub fn bits(self) -> <T as RawBitFlags>::Numeric

Returns the underlying bitwise value.

#[bitflags]
#[repr(u8)]
#[derive(Clone, Copy)]
enum Flags {
    Foo = 1 << 0,
    Bar = 1 << 1,
}

let both_flags = Flags::Foo | Flags::Bar;
assert_eq!(both_flags.bits(), 0b11);
source

pub fn intersects<B>(self, other: B) -> boolwhere B: Into<BitFlags<T>>,

Returns true if at least one flag is shared.

source

pub fn contains<B>(self, other: B) -> boolwhere B: Into<BitFlags<T>>,

Returns true if all flags are contained.

source

pub fn toggle<B>(&mut self, other: B)where B: Into<BitFlags<T>>,

Toggles the matching bits

source

pub fn insert<B>(&mut self, other: B)where B: Into<BitFlags<T>>,

Inserts the flags into the BitFlag

source

pub fn remove<B>(&mut self, other: B)where B: Into<BitFlags<T>>,

Removes the matching flags

source

pub fn iter(self) -> Iter<T>

Returns an iterator that yields each set flag

source§

impl<T> BitFlags<T, u8>

source

pub const unsafe fn from_bits_unchecked_c( val: u8, const_token: ConstToken<T, u8> ) -> BitFlags<T, u8>

Create a new BitFlags unsafely, without checking if the bits form a valid bit pattern for the type.

Const variant of from_bits_unchecked.

Consider using from_bits_truncate_c instead.

Safety

All bits set in val must correspond to a value of the enum.

source

pub const fn from_bits_truncate_c( bits: u8, const_token: ConstToken<T, u8> ) -> BitFlags<T, u8>

Create a BitFlags<T> from an underlying bitwise value. If any invalid bits are set, ignore them.

#[bitflags]
#[repr(u8)]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
enum MyFlag {
    One = 1 << 0,
    Two = 1 << 1,
    Three = 1 << 2,
}

const FLAGS: BitFlags<MyFlag> =
    BitFlags::<MyFlag>::from_bits_truncate_c(0b10101010, BitFlags::CONST_TOKEN);
assert_eq!(FLAGS, MyFlag::Two);
source

pub const fn union_c(self, other: BitFlags<T, u8>) -> BitFlags<T, u8>

Bitwise OR — return value contains flag if either argument does.

Also available as a | b, but operator overloads are not usable in const fns at the moment.

source

pub const fn intersection_c(self, other: BitFlags<T, u8>) -> BitFlags<T, u8>

Bitwise AND — return value contains flag if both arguments do.

Also available as a & b, but operator overloads are not usable in const fns at the moment.

source

pub const fn not_c(self, const_token: ConstToken<T, u8>) -> BitFlags<T, u8>

Bitwise NOT — return value contains flag if argument doesn’t.

Also available as !a, but operator overloads are not usable in const fns at the moment.

Moreover, due to const fn limitations, not_c needs a ConstToken as an argument.

#[bitflags]
#[repr(u8)]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
enum MyFlag {
    One = 1 << 0,
    Two = 1 << 1,
    Three = 1 << 2,
}

const FLAGS: BitFlags<MyFlag> = make_bitflags!(MyFlag::{One | Two});
const NEGATED: BitFlags<MyFlag> = FLAGS.not_c(BitFlags::CONST_TOKEN);
assert_eq!(NEGATED, MyFlag::Three);
source

pub const fn bits_c(self) -> u8

Returns the underlying bitwise value.

const variant of bits.

Trait Implementations§

source§

impl<T> Binary for BitFlags<T>where T: BitFlag, <T as RawBitFlags>::Numeric: Binary,

source§

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

Formats the value using the given formatter.
source§

impl<T, B> BitAnd<B> for BitFlags<T>where T: BitFlag, B: Into<BitFlags<T>>,

§

type Output = BitFlags<T>

The resulting type after applying the & operator.
source§

fn bitand(self, other: B) -> BitFlags<T>

Performs the & operation. Read more
source§

impl<T, B> BitAndAssign<B> for BitFlags<T>where T: BitFlag, B: Into<BitFlags<T>>,

source§

fn bitand_assign(&mut self, other: B)

Performs the &= operation. Read more
source§

impl<T, B> BitOr<B> for BitFlags<T>where T: BitFlag, B: Into<BitFlags<T>>,

§

type Output = BitFlags<T>

The resulting type after applying the | operator.
source§

fn bitor(self, other: B) -> BitFlags<T>

Performs the | operation. Read more
source§

impl<T, B> BitOrAssign<B> for BitFlags<T>where T: BitFlag, B: Into<BitFlags<T>>,

source§

fn bitor_assign(&mut self, other: B)

Performs the |= operation. Read more
source§

impl<T, B> BitXor<B> for BitFlags<T>where T: BitFlag, B: Into<BitFlags<T>>,

§

type Output = BitFlags<T>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, other: B) -> BitFlags<T>

Performs the ^ operation. Read more
source§

impl<T, B> BitXorAssign<B> for BitFlags<T>where T: BitFlag, B: Into<BitFlags<T>>,

source§

fn bitxor_assign(&mut self, other: B)

Performs the ^= operation. Read more
source§

impl<T, N> Clone for BitFlags<T, N>where T: Clone, N: Clone,

source§

fn clone(&self) -> BitFlags<T, N>

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<T> Debug for BitFlags<T>where T: BitFlag + Debug,

source§

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

Formats the value using the given formatter. Read more
source§

impl<T> Default for BitFlags<T>where T: BitFlag,

The default value returned is one with all flags unset, i. e. empty, unless customized.

source§

fn default() -> BitFlags<T>

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

impl<'a, T> Deserialize<'a> for BitFlags<T>where T: BitFlag, <T as RawBitFlags>::Numeric: Deserialize<'a> + Into<u64>,

source§

fn deserialize<D>(d: D) -> Result<BitFlags<T>, <D as Deserializer<'a>>::Error>where D: Deserializer<'a>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<T> Display for BitFlags<T>where T: BitFlag + Debug,

source§

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

Formats the value using the given formatter. Read more
source§

impl<T, B> Extend<B> for BitFlags<T>where T: BitFlag, B: Into<BitFlags<T>>,

source§

fn extend<I>(&mut self, it: I)where I: IntoIterator<Item = B>,

Extends a collection with the contents of an iterator. Read more
source§

fn extend_one(&mut self, item: A)

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

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. Read more
source§

impl<T> From<T> for BitFlags<T>where T: BitFlag,

source§

fn from(t: T) -> BitFlags<T>

Converts to this type from the input type.
source§

impl<T, B> FromIterator<B> for BitFlags<T>where T: BitFlag, B: Into<BitFlags<T>>,

source§

fn from_iter<I>(it: I) -> BitFlags<T>where I: IntoIterator<Item = B>,

Creates a value from an iterator. Read more
source§

impl<T, N> Hash for BitFlags<T, N>where N: Hash,

source§

fn hash<H>(&self, state: &mut H)where H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

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

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

impl<T> IntoIterator for BitFlags<T>where T: BitFlag,

§

type IntoIter = Iter<T>

Which kind of iterator are we turning this into?
§

type Item = T

The type of the elements being iterated over.
source§

fn into_iter(self) -> <BitFlags<T> as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
source§

impl<T> LowerHex for BitFlags<T>where T: BitFlag, <T as RawBitFlags>::Numeric: LowerHex,

source§

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

Formats the value using the given formatter.
source§

impl<T> Not for BitFlags<T>where T: BitFlag,

§

type Output = BitFlags<T>

The resulting type after applying the ! operator.
source§

fn not(self) -> BitFlags<T>

Performs the unary ! operation. Read more
source§

impl<T> Octal for BitFlags<T>where T: BitFlag, <T as RawBitFlags>::Numeric: Octal,

source§

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

Formats the value using the given formatter.
source§

impl<T> PartialEq<T> for BitFlags<T>where T: BitFlag,

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T, N> PartialEq for BitFlags<T, N>where N: PartialEq,

source§

fn eq(&self, other: &BitFlags<T, N>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T> Serialize for BitFlags<T>where T: BitFlag, <T as RawBitFlags>::Numeric: Serialize,

source§

fn serialize<S>( &self, s: S ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<T> TryFrom<u128> for BitFlags<T>where T: BitFlag<Numeric = u128>,

§

type Error = FromBitsError<T>

The type returned in the event of a conversion error.
source§

fn try_from( bits: <T as RawBitFlags>::Numeric ) -> Result<BitFlags<T>, <BitFlags<T> as TryFrom<u128>>::Error>

Performs the conversion.
source§

impl<T> TryFrom<u16> for BitFlags<T>where T: BitFlag<Numeric = u16>,

§

type Error = FromBitsError<T>

The type returned in the event of a conversion error.
source§

fn try_from( bits: <T as RawBitFlags>::Numeric ) -> Result<BitFlags<T>, <BitFlags<T> as TryFrom<u16>>::Error>

Performs the conversion.
source§

impl<T> TryFrom<u32> for BitFlags<T>where T: BitFlag<Numeric = u32>,

§

type Error = FromBitsError<T>

The type returned in the event of a conversion error.
source§

fn try_from( bits: <T as RawBitFlags>::Numeric ) -> Result<BitFlags<T>, <BitFlags<T> as TryFrom<u32>>::Error>

Performs the conversion.
source§

impl<T> TryFrom<u64> for BitFlags<T>where T: BitFlag<Numeric = u64>,

§

type Error = FromBitsError<T>

The type returned in the event of a conversion error.
source§

fn try_from( bits: <T as RawBitFlags>::Numeric ) -> Result<BitFlags<T>, <BitFlags<T> as TryFrom<u64>>::Error>

Performs the conversion.
source§

impl<T> TryFrom<u8> for BitFlags<T>where T: BitFlag<Numeric = u8>,

§

type Error = FromBitsError<T>

The type returned in the event of a conversion error.
source§

fn try_from( bits: <T as RawBitFlags>::Numeric ) -> Result<BitFlags<T>, <BitFlags<T> as TryFrom<u8>>::Error>

Performs the conversion.
source§

impl<T> UpperHex for BitFlags<T>where T: BitFlag, <T as RawBitFlags>::Numeric: UpperHex,

source§

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

Formats the value using the given formatter.
source§

impl<T, N> Copy for BitFlags<T, N>where T: Copy, N: Copy,

source§

impl<T, N> Eq for BitFlags<T, N>where T: Eq, N: Eq,

source§

impl<T, N> StructuralEq for BitFlags<T, N>

Auto Trait Implementations§

§

impl<T, N> RefUnwindSafe for BitFlags<T, N>where N: RefUnwindSafe, T: RefUnwindSafe,

§

impl<T, N> Send for BitFlags<T, N>where N: Send, T: Send,

§

impl<T, N> Sync for BitFlags<T, N>where N: Sync, T: Sync,

§

impl<T, N> Unpin for BitFlags<T, N>where N: Unpin, T: Unpin,

§

impl<T, N> UnwindSafe for BitFlags<T, N>where N: UnwindSafe, T: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> CallHasher for Twhere T: Hash + ?Sized,

source§

fn get_hash<H, B>(value: &H, build_hasher: &B) -> u64where H: Hash + ?Sized, B: BuildHasher,

source§

impl<T> Conv for T

source§

fn conv<T>(self) -> Twhere Self: Into<T>,

Converts self into T using Into<T>. Read more
source§

impl<Choices> CoproductSubsetter<CNil, HNil> for Choices

§

type Remainder = Choices

source§

fn subset( self ) -> Result<CNil, <Choices as CoproductSubsetter<CNil, HNil>>::Remainder>

Extract a subset of the possible types in a coproduct (or get the remaining possibilities) Read more
source§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> FmtForward for T

source§

fn fmt_binary(self) -> FmtBinary<Self>where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
source§

fn fmt_display(self) -> FmtDisplay<Self>where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
source§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
source§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
source§

fn fmt_octal(self) -> FmtOctal<Self>where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
source§

fn fmt_pointer(self) -> FmtPointer<Self>where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
source§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
source§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
source§

fn fmt_list(self) -> FmtList<Self>where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

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

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U, I> LiftInto<U, I> for Twhere U: LiftFrom<T, I>,

source§

fn lift_into(self) -> U

Performs the indexed conversion.
source§

impl<T> Pipe for Twhere T: ?Sized,

source§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
source§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
source§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
source§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
source§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R ) -> Rwhere Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
source§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
source§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
source§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> Rwhere Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
source§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R ) -> Rwhere Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<Source> Sculptor<HNil, HNil> for Source

§

type Remainder = Source

source§

fn sculpt(self) -> (HNil, <Source as Sculptor<HNil, HNil>>::Remainder)

Consumes the current HList and returns an HList with the requested shape. Read more
source§

impl<T> Tap for T

source§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
source§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
source§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
source§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
source§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
source§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
source§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
source§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
source§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
source§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
source§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
source§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
source§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
source§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
source§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Selfwhere Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
source§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

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

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

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T> TryConv for T

source§

fn try_conv<T>(self) -> Result<T, Self::Error>where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,