Enum bitvec::domain::Domain[][src]

pub enum Domain<'a, T> where
    T: 'a + BitStore
{ Enclave { head: BitIdx<T::Mem>, elem: &'a T, tail: BitTail<T::Mem>, }, Region { head: Option<(BitIdx<T::Mem>, &'a T)>, body: &'a [T::Mem], tail: Option<(&'a T, BitTail<T::Mem>)>, }, }

Granular representation of the memory region containing a BitSlice.

BitSlice regions can be described in terms of edge and center elements, where the edge elements retain the aliasing status of the source BitSlice handle, and the center elements are known to be completely unaliased by any other view. This property allows any BitSlice handle to be decomposed into smaller regions, and safely remove any aliasing markers from the subregion of memory that no longer requires them for correct access.

This enum splits the element region backing a BitSlice into maybe-aliased and known-unaliased subslices. If you do not need to work directly with the memory elements, and only need to firmly specify the aliasing status of a BitSlice, see the BitDomain and BitDomainMut enums.

Lifetimes

  • 'a: The lifetime of the referent storage region.

Type Parameters

  • T: The element type of the source BitSlice handle, including aliasing markers.

Variants

Enclave

Indicates that a BitSlice is contained entirely in the interior indices of a single memory element.

Fields of Enclave

head: BitIdx<T::Mem>

The start index of the BitSlice.

elem: &'a T

An aliased view of the element containing the BitSlice.

This is necessary even on immutable views, because other views to the referent element may be permitted to modify it.

tail: BitTail<T::Mem>

The end index of the BitSlice.

Region

Indicates that a BitSlice region touches at least one edge index of any number of elements.

This contains two optional references to the aliased edges, and one reference to the unaliased middle. Each can be queried and used individually.

Fields of Region

head: Option<(BitIdx<T::Mem>, &'a T)>

If the BitSlice started in the interior of its first element, this contains the starting index and the base address.

body: &'a [T::Mem]

All fully-spanned, unaliased, elements.

This is marked as bare memory without any access protections, because it is statically impossible for any other handle to have write access to the region it covers. As such, a bitslice that was marked as entirely aliased, but contains interior unaliased elements, can safely remove its aliasing protections.

Safety Exception

&BitSlice<O, T::Alias> references have access to a .set_aliased method, which represents the only means in bitvec of writing to memory without an exclusive &mut reference.

Construction of two such shared, aliasing, references over the same data, then construction of a domain view over one of them and simultaneous writing through the other to interior elements marked as unaliased, will cause the domain view to be undefined behavior. Do not combine domain views and .set_aliased calls.

tail: Option<(&'a T, BitTail<T::Mem>)>

If the BitSlice ended in the interior of its last element, this contains the ending index and the last address.

Implementations

impl<'a, T> Domain<'a, T> where
    T: 'a + BitStore
[src]

pub fn enclave(self) -> Option<(BitIdx<T::Mem>, &'a T, BitTail<T::Mem>)>[src]

Attempts to view the domain as an enclave variant.

Parameters

  • self

Returns

If self is the Enclave variant, this returns Some of the enclave fields, as a tuple. Otherwise, it returns None.

pub fn region(
    self
) -> Option<(Option<(BitIdx<T::Mem>, &'a T)>, &'a [T::Mem], Option<(&'a T, BitTail<T::Mem>)>)>
[src]

Attempts to view the domain as the region variant.

Parameters

  • self

Returns

If self is the Region variant, this returns Some of the region fields, as a tuple. Otherwise, it returns None.

Trait Implementations

impl<T> Binary for Domain<'_, T> where
    T: BitStore
[src]

impl<T> Clone for Domain<'_, T> where
    T: BitStore
[src]

impl<T> Copy for Domain<'_, T> where
    T: BitStore
[src]

impl<'a, T: Debug> Debug for Domain<'a, T> where
    T: 'a + BitStore,
    T::Mem: Debug,
    T::Mem: Debug,
    T::Mem: Debug,
    T::Mem: Debug,
    T::Mem: Debug
[src]

impl<'a, T> DoubleEndedIterator for Domain<'a, T> where
    T: 'a + BitStore
[src]

impl<T> ExactSizeIterator for Domain<'_, T> where
    T: BitStore
[src]

impl<T> FusedIterator for Domain<'_, T> where
    T: BitStore
[src]

impl<'a, T> Iterator for Domain<'a, T> where
    T: 'a + BitStore
[src]

type Item = T::Mem

The type of the elements being iterated over.

impl<T> LowerHex for Domain<'_, T> where
    T: BitStore
[src]

impl<T> Octal for Domain<'_, T> where
    T: BitStore
[src]

impl<T> Serialize for Domain<'_, T> where
    T: BitStore,
    T::Mem: Serialize
[src]

impl<T> UpperHex for Domain<'_, T> where
    T: BitStore
[src]

Auto Trait Implementations

impl<'a, T> RefUnwindSafe for Domain<'a, T> where
    T: RefUnwindSafe,
    <T as BitStore>::Mem: RefUnwindSafe

impl<'a, T> Send for Domain<'a, T> where
    T: Sync

impl<'a, T> Sync for Domain<'a, T> where
    T: Sync

impl<'a, T> Unpin for Domain<'a, T>

impl<'a, T> UnwindSafe for Domain<'a, T> where
    T: RefUnwindSafe,
    <T as BitStore>::Mem: RefUnwindSafe + UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T[src]

impl<T> Conv for T[src]

impl<T> FmtForward for T[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T> Pipe for T where
    T: ?Sized
[src]

impl<T> Pipe for T[src]

impl<T> PipeAsRef for T[src]

impl<T> PipeBorrow for T[src]

impl<T> PipeDeref for T[src]

impl<T> PipeRef for T[src]

impl<T> Tap for T[src]

impl<T> Tap for T[src]

impl<T, U> TapAsRef<U> for T where
    U: ?Sized
[src]

impl<T, U> TapBorrow<U> for T where
    U: ?Sized
[src]

impl<T> TapDeref for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> TryConv for T[src]

impl<T> TryConv for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.