pub enum BitDomain<'a, M = Const, T = usize, O = Lsb0> where
M: Mutability,
T: 'a + BitStore,
O: BitOrder,
Address<M, BitSlice<T, O>>: Referential<'a>,
Address<M, BitSlice<T::Unalias, O>>: Referential<'a>, {
Enclave(Reference<'a, M, BitSlice<T, O>>),
Region {
head: Reference<'a, M, BitSlice<T, O>>,
body: Reference<'a, M, BitSlice<T::Unalias, O>>,
tail: Reference<'a, M, BitSlice<T, O>>,
},
}
Expand description
Bit-Slice Partitioning
This enum partitions a bit-slice into its head- and tail- edge bit-slices, and its interior body bit-slice, according to the definitions laid out in the module documentation.
It fragments a BitSlice
into smaller BitSlice
s, and allows the interior
bit-slice to become ::Unalias
ed. This is useful when you need to retain a
bit-slice view of memory, but wish to remove synchronization costs imposed by a
prior call to .split_at_mut()
for as much of the bit-slice as possible.
Why Not Option
?
The Enclave
variant always contains as its single field the exact bit-slice
that created the Enclave
. As such, this type is easily replaceäble with an
Option
of the Region
variant, which when None
is understood to be the
original.
This exists as a dedicated enum, even with a technically useless variant, in
order to mirror the shape of the element-domain enum. This type should be
understood as a shortcut to the end result of splitting by element-domain, then
mapping each PartialElement
and slice back into BitSlice
s, rather than
testing whether a bit-slice can be split on alias boundaries.
You can get the alternate behavior, of testing whether or not a bit-slice can be
split into a Region
or is unsplittable, by calling .bit_domain().region()
to produce exactly such an Option
.
Variants
Enclave(Reference<'a, M, BitSlice<T, O>>)
Indicates that a bit-slice’s contents are entirely in the interior indices of a single memory element.
The contained value is always the bit-slice that created this view.
Region
Fields
head: Reference<'a, M, BitSlice<T, O>>
Any bits that partially-fill the first element of the underlying storage region.
This does not modify its aliasing status, as it will already be appropriately marked before this view is constructed.
body: Reference<'a, M, BitSlice<T::Unalias, O>>
Any bits that wholly-fill elements in the interior of the bit-slice.
This is marked as unaliased, because it is statically impossible for
any other handle derived from the source bit-slice to have
conflicting access to the region of memory it describes. As such,
even a bit-slice that was marked as ::Alias
can revert this
protection on the known-unaliased interior.
Proofs:
- Rust’s
&
/&mut
exclusion rules universally apply. If a reference exists, no other reference has unsynchronized write capability. BitStore::Unalias
only modifies unsynchronized types.Cell
and atomic types unalias to themselves, and retain their original behavior.
Indicates that a bit-slice’s contents touch an element edge.
This splits the bit-slice into three partitions, each of which may be empty: two partially-occupied edge elements, with their original type status, and one interior span, which is known to not have any other aliases derived from the bit-slice that created this view.
Implementations
impl<'a, M, T, O> BitDomain<'a, M, T, O> where
M: Mutability,
T: 'a + BitStore,
O: BitOrder,
Address<M, BitSlice<T, O>>: Referential<'a>,
Address<M, BitSlice<T::Unalias, O>>: Referential<'a>,
impl<'a, M, T, O> BitDomain<'a, M, T, O> where
M: Mutability,
T: 'a + BitStore,
O: BitOrder,
Address<M, BitSlice<T, O>>: Referential<'a>,
Address<M, BitSlice<T::Unalias, O>>: Referential<'a>,
Attempts to unpack the bit-domain as an Enclave
variant. This is
just a shorthand for explicit destructuring.
Trait Implementations
Auto Trait Implementations
impl<'a, M = Const, T = usize, O = Lsb0> !RefUnwindSafe for BitDomain<'a, M, T, O>
impl<'a, M = Const, T = usize, O = Lsb0> !UnwindSafe for BitDomain<'a, M, T, O>
Blanket Implementations
Mutably borrows from an owned value. Read more
Causes self
to use its Binary
implementation when Debug
-formatted. Read more
Causes self
to use its Display
implementation when
Debug
-formatted. Read more
Causes self
to use its LowerExp
implementation when
Debug
-formatted. Read more
Causes self
to use its LowerHex
implementation when
Debug
-formatted. Read more
Causes self
to use its Octal
implementation when Debug
-formatted. Read more
Causes self
to use its Pointer
implementation when
Debug
-formatted. Read more
Causes self
to use its UpperExp
implementation when
Debug
-formatted. Read more
Causes self
to use its UpperHex
implementation when
Debug
-formatted. Read more
Pipes by value. This is generally the method you want to use. Read more
Borrows self
and passes that borrow into the pipe function. Read more
Mutably borrows self
and passes that borrow into the pipe function. Read more
Borrows self
, then passes self.borrow()
into the pipe function. Read more
Mutably borrows self
, then passes self.borrow_mut()
into the pipe
function. Read more
Borrows self
, then passes self.as_ref()
into the pipe function.
Mutably borrows self
, then passes self.as_mut()
into the pipe
function. Read more
Borrows self
, then passes self.deref()
into the pipe function.
Immutable access to the Borrow<B>
of a value. Read more
Mutable access to the BorrowMut<B>
of a value. Read more
Immutable access to the AsRef<R>
view of a value. Read more
Mutable access to the AsMut<R>
view of a value. Read more
Immutable access to the Deref::Target
of a value. Read more
Mutable access to the Deref::Target
of a value. Read more
Calls .tap()
only in debug builds, and is erased in release builds.
Calls .tap_mut()
only in debug builds, and is erased in release
builds. Read more
Calls .tap_borrow()
only in debug builds, and is erased in release
builds. Read more
Calls .tap_borrow_mut()
only in debug builds, and is erased in release
builds. Read more
Calls .tap_ref()
only in debug builds, and is erased in release
builds. Read more
Calls .tap_ref_mut()
only in debug builds, and is erased in release
builds. Read more
Calls .tap_deref()
only in debug builds, and is erased in release
builds. Read more