pub struct RangeStore<T> {
pub ranges: BTreeMap<usize, (T, usize, usize)>,
}Fields§
§ranges: BTreeMap<usize, (T, usize, usize)>key: lsb (absolute position) value: (expression, width, origin LSB when this data was originally placed)
Implementations§
Source§impl<T> RangeStore<T>
impl<T> RangeStore<T>
Sourcepub fn aligned_parts<'a, U>(
&'a self,
other: &'a RangeStore<U>,
) -> Result<Vec<AlignedRangePart<'a, T, U>>, RangeStoreError>
pub fn aligned_parts<'a, U>( &'a self, other: &'a RangeStore<U>, ) -> Result<Vec<AlignedRangePart<'a, T, U>>, RangeStoreError>
Align two sparse partitions in one ordered pass.
Each returned absolute range is bounded by the next boundary from either store. The accompanying accesses are relative to each value’s original placement, so callers can slice the values without searching either map again.
Source§impl<T: Clone + PartialEq + Eq> RangeStore<T>
impl<T: Clone + PartialEq + Eq> RangeStore<T>
pub fn new(initial: T, width: usize) -> Self
Sourcepub fn split_at(&mut self, bit: usize) -> Result<(), RangeStoreError>
pub fn split_at(&mut self, bit: usize) -> Result<(), RangeStoreError>
Split the range at the specified bit position. Even if split, origin_lsb (the 3rd element) is maintained.
Sourcepub fn update(
&mut self,
access: BitAccess,
value: T,
) -> Result<(), RangeStoreError>
pub fn update( &mut self, access: BitAccess, value: T, ) -> Result<(), RangeStoreError>
Update the specified range with a new value. The origin_lsb of the updated range will match access.lsb of that assignment.
Sourcepub fn get_parts_ref(
&self,
access: BitAccess,
) -> Result<Vec<(&T, BitAccess)>, RangeStoreError>
pub fn get_parts_ref( &self, access: BitAccess, ) -> Result<Vec<(&T, BitAccess)>, RangeStoreError>
Returns borrowed parts overlapping with the requested range. relative_access will be the relative position from the origin of that expression.
Trait Implementations§
Source§impl<T: Clone> Clone for RangeStore<T>
impl<T: Clone> Clone for RangeStore<T>
Source§fn clone(&self) -> RangeStore<T>
fn clone(&self) -> RangeStore<T>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: Debug> Debug for RangeStore<T>
impl<T: Debug> Debug for RangeStore<T>
Source§impl<'de, T> Deserialize<'de> for RangeStore<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for RangeStore<T>where
T: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl<T: Eq> Eq for RangeStore<T>
Source§impl<T: PartialEq> PartialEq for RangeStore<T>
impl<T: PartialEq> PartialEq for RangeStore<T>
Source§impl<T> Serialize for RangeStore<T>where
T: Serialize,
impl<T> Serialize for RangeStore<T>where
T: Serialize,
impl<T: PartialEq> StructuralPartialEq for RangeStore<T>
Auto Trait Implementations§
impl<T> Freeze for RangeStore<T>
impl<T> RefUnwindSafe for RangeStore<T>
impl<T> Send for RangeStore<T>
impl<T> Sync for RangeStore<T>
impl<T> Unpin for RangeStore<T>
impl<T> UnsafeUnpin for RangeStore<T>
impl<T> UnwindSafe for RangeStore<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more