Trait bitfield_layout::BitFieldLayout[][src]

pub trait BitFieldLayout: Layout {
    type Value: Copy + IntoBits;
    fn get(&self) -> Self::Value;
fn set(&mut self, new: Self::Value); fn replace(&mut self, new: Self::Value) -> Self::Value { ... }
fn swap(&mut self, other: &mut Self) { ... }
fn update<F>(&mut self, f: F) -> Self::Value
    where
        F: FnOnce(Self::Value) -> Self::Value
, { ... }
fn bits(&self) -> Bits<<Self::Value as IntoBits>::Bytes>

Notable traits for Bits<I>

impl<I: Iterator<Item = u8>> Iterator for Bits<I> type Item = bool;
{ ... }
fn flags(
        &self
    ) -> Flags<Self::Layout, Bits<<Self::Value as IntoBits>::Bytes>>

Notable traits for Flags<L, B>

impl<L, B> Iterator for Flags<L, B> where
    L: Iterator,
    B: Iterator<Item = bool>, 
type Item = Flag<L::Item>;
{ ... }
fn diff(
        &self,
        other: Self
    ) -> Diff<Self::Layout, Bits<<Self::Value as IntoBits>::Bytes>>

Notable traits for Diff<L, B>

impl<L, T, B> Iterator for Diff<L, B> where
    L: Iterator<Item = T>,
    B: Iterator<Item = bool>, 
type Item = Either<(usize, T), (usize, T)>;

    where
        Self: Sized
, { ... } }
Expand description

Main trait for creating bitfield

In general you need implement this trait and its dependencies: Layout. This trait already implemented for BitField.

Associated Types

Required methods

fn get(&self) -> Self::Value[src]

Returns a copy of the contained value.

fn set(&mut self, new: Self::Value)[src]

Sets the contained value.

Provided methods

fn replace(&mut self, new: Self::Value) -> Self::Value[src]

Replaces the contained value with val, and returns the old contained value.

fn swap(&mut self, other: &mut Self)[src]

Swaps the values of two bitfields.

fn update<F>(&mut self, f: F) -> Self::Value where
    F: FnOnce(Self::Value) -> Self::Value
[src]

Updates the contained value using a function and returns the new value.

fn bits(&self) -> Bits<<Self::Value as IntoBits>::Bytes>

Notable traits for Bits<I>

impl<I: Iterator<Item = u8>> Iterator for Bits<I> type Item = bool;
[src]

Return iterator through bitfield value bits. Every bit represents as bool value.

fn flags(&self) -> Flags<Self::Layout, Bits<<Self::Value as IntoBits>::Bytes>>

Notable traits for Flags<L, B>

impl<L, B> Iterator for Flags<L, B> where
    L: Iterator,
    B: Iterator<Item = bool>, 
type Item = Flag<L::Item>;
[src]

Return iterator through bitfield value flags. Every flag contains bit state (set or unset) and item (record) value - string in simple case.

fn diff(
    &self,
    other: Self
) -> Diff<Self::Layout, Bits<<Self::Value as IntoBits>::Bytes>>

Notable traits for Diff<L, B>

impl<L, T, B> Iterator for Diff<L, B> where
    L: Iterator<Item = T>,
    B: Iterator<Item = bool>, 
type Item = Either<(usize, T), (usize, T)>;
where
    Self: Sized
[src]

Helps to find difference between two bitfield values.

Implementors

impl<M: Layout, T: Copy + IntoBits> BitFieldLayout for BitField<M, T>[src]

type Value = T

fn get(&self) -> Self::Value[src]

fn set(&mut self, new: Self::Value)[src]