Struct FlagBuffer

Source
pub struct FlagBuffer<B, T>(/* private fields */);
Expand description

A buffer of flag constants.

Implementations§

Source§

impl<'a, B, T> FlagBuffer<B, T>
where B: Default + BitAnd<B, Output = B> + BitAndAssign<B> + BitOr<B, Output = B> + BitOrAssign<B> + Not<Output = B> + From<&'a T> + PartialEq + Copy, T: 'a,

Source

pub fn empty() -> Self

Create an empty set of flags.

Source

pub fn from_bitmask(bitmask: B) -> Self

Create a FlagBuffer from a bitmask.

Source

pub fn contains(&self, elem: &'a T) -> bool

Check whether the set of flags contains the given flag.

Source

pub fn set(&mut self, flag: &'a T)

Add a flag to the set of flags.

Source

pub fn unset(&mut self, flag: &'a T)

Remove a flag from the set of flags.

Trait Implementations§

Source§

impl<B: Debug, T: Debug> Debug for FlagBuffer<B, T>

Source§

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

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

impl<'a, B, T> From<&'a [T]> for FlagBuffer<B, T>
where B: Default + BitOr<B, Output = B> + From<&'a T>,

Source§

fn from(slice: &'a [T]) -> Self

Converts to this type from the input type.
Source§

impl<'lifetime, B: FromBytes<'lifetime> + TypeSize + Debug, T: FromBytes<'lifetime>> FromBytes<'lifetime> for FlagBuffer<B, T>

Source§

fn from_bytes(buffer: &mut Cursor<&'lifetime [u8]>) -> Result<Self, DeError>

Takes a byte buffer and returns the deserialized data structure.
Source§

fn strip(buffer: &mut Cursor<&'a [u8]>) -> Result<(), DeError>

Strip padding from a netlink message.
Source§

impl<B: PartialEq, T: PartialEq> PartialEq for FlagBuffer<B, T>

Source§

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

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

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<B: Size, T: Size> Size for FlagBuffer<B, T>

Source§

fn unpadded_size(&self) -> usize

Size of the unpadded data structure. This will usually only be unaligned for variable length types like strings or byte buffers.
Source§

fn padded_size(&self) -> usize

Get the size of of the payload and align it to the required netlink byte alignment.
Source§

impl<B: ToBytes, T: ToBytes> ToBytes for FlagBuffer<B, T>

Source§

fn to_bytes(&self, buffer: &mut Cursor<Vec<u8>>) -> Result<(), SerError>

Takes a byte buffer and serializes the data structure into it.
Source§

fn pad(&self, buffer: &mut Cursor<Vec<u8>>) -> Result<(), SerError>

Pad a netlink message to the appropriate alignment.
Source§

impl<B, T> TypeSize for FlagBuffer<B, T>
where B: TypeSize,

Source§

fn type_size() -> usize

Get the size of a constant-sized data type.
Source§

impl<B: Eq, T: Eq> Eq for FlagBuffer<B, T>

Source§

impl<B, T> StructuralPartialEq for FlagBuffer<B, T>

Auto Trait Implementations§

§

impl<B, T> Freeze for FlagBuffer<B, T>
where B: Freeze,

§

impl<B, T> RefUnwindSafe for FlagBuffer<B, T>

§

impl<B, T> Send for FlagBuffer<B, T>
where B: Send, T: Send,

§

impl<B, T> Sync for FlagBuffer<B, T>
where B: Sync, T: Sync,

§

impl<B, T> Unpin for FlagBuffer<B, T>
where B: Unpin, T: Unpin,

§

impl<B, T> UnwindSafe for FlagBuffer<B, T>
where B: UnwindSafe, T: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where 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> TryFrom<U> for T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.