pub struct MemoryPosition<T = usize> { /* private fields */ }Expand description
MemoryPosition tracks the current indices for various aspects of the memory system to
ensure consistency when allocating new features or patterns.
Implementations§
Source§impl<T> MemoryPosition<T>
impl<T> MemoryPosition<T>
Sourcepub fn new(feature_id: T, pattern_id: T) -> MemoryPosition<T>
pub fn new(feature_id: T, pattern_id: T) -> MemoryPosition<T>
returns a new instance of MemoryPosition using the provided feature_id and
pattern_id.
Sourcepub fn default() -> MemoryPosition<T>where
T: Default,
pub fn default() -> MemoryPosition<T>where
T: Default,
initializes a new instance using the logical Default for type T.
Sourcepub fn one() -> MemoryPosition<T>where
T: One,
pub fn one() -> MemoryPosition<T>where
T: One,
initialize a new instance using num_traits::One
Sourcepub fn zero() -> MemoryPosition<T>where
T: Zero,
pub fn zero() -> MemoryPosition<T>where
T: Zero,
initialize a new instance using num_traits::Zero
Sourcepub fn from_feature_id(feature_id: T) -> MemoryPosition<T>where
T: Default,
pub fn from_feature_id(feature_id: T) -> MemoryPosition<T>where
T: Default,
creates a new instance of MemoryPosition from a given feature_id and a default
pattern_id.
Sourcepub fn from_pattern_id(pattern_id: T) -> MemoryPosition<T>where
T: Default,
pub fn from_pattern_id(pattern_id: T) -> MemoryPosition<T>where
T: Default,
creates a new instance of MemoryPosition from a given pattern_id and a default
feature_id.
Sourcepub const fn feature_id(&self) -> &T
pub const fn feature_id(&self) -> &T
returns an immutable reference to the current feature id
Sourcepub const fn feature_id_mut(&mut self) -> &mut T
pub const fn feature_id_mut(&mut self) -> &mut T
returns a mutable reference to the current feature id
Sourcepub const fn pattern_id(&self) -> &T
pub const fn pattern_id(&self) -> &T
returns an immutable reference to the current pattern id
Sourcepub const fn pattern_id_mut(&mut self) -> &mut T
pub const fn pattern_id_mut(&mut self) -> &mut T
returns a mutable reference to the current pattern id
Sourcepub const fn replace_feature_id(&mut self, id: T) -> T
pub const fn replace_feature_id(&mut self, id: T) -> T
replace the current feature ID with the given id and return
the old value.
Sourcepub const fn replace_pattern_id(&mut self, id: T) -> T
pub const fn replace_pattern_id(&mut self, id: T) -> T
replace the current pattern ID with the given id and return
the old value.
Sourcepub fn next_feature_id(&mut self) -> T
pub fn next_feature_id(&mut self) -> T
returns the current feature id, replacing it with the logical successor
Sourcepub fn next_pattern_id(&mut self) -> T
pub fn next_pattern_id(&mut self) -> T
returns the current pattern id and replaces it with an incremented value
Trait Implementations§
Source§impl<T> Clone for MemoryPosition<T>where
T: Clone,
impl<T> Clone for MemoryPosition<T>where
T: Clone,
Source§fn clone(&self) -> MemoryPosition<T>
fn clone(&self) -> MemoryPosition<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<T> Debug for MemoryPosition<T>where
T: Debug,
impl<T> Debug for MemoryPosition<T>where
T: Debug,
Source§impl<T> Default for MemoryPosition<T>where
T: Default,
impl<T> Default for MemoryPosition<T>where
T: Default,
Source§fn default() -> MemoryPosition<T>
fn default() -> MemoryPosition<T>
Source§impl<'de, T> Deserialize<'de> for MemoryPosition<T>
impl<'de, T> Deserialize<'de> for MemoryPosition<T>
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<MemoryPosition<T>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<MemoryPosition<T>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl<T> Display for MemoryPosition<T>where
T: Display,
impl<T> Display for MemoryPosition<T>where
T: Display,
Source§impl<T> Hash for MemoryPosition<T>where
T: Hash,
impl<T> Hash for MemoryPosition<T>where
T: Hash,
Source§impl<T> Ord for MemoryPosition<T>where
T: Ord,
impl<T> Ord for MemoryPosition<T>where
T: Ord,
Source§fn cmp(&self, other: &MemoryPosition<T>) -> Ordering
fn cmp(&self, other: &MemoryPosition<T>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<T> PartialEq for MemoryPosition<T>where
T: PartialEq,
impl<T> PartialEq for MemoryPosition<T>where
T: PartialEq,
Source§impl<T> PartialOrd for MemoryPosition<T>where
T: PartialOrd,
impl<T> PartialOrd for MemoryPosition<T>where
T: PartialOrd,
Source§impl<T> Serialize for MemoryPosition<T>where
T: Serialize,
impl<T> Serialize for MemoryPosition<T>where
T: Serialize,
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl<T> Copy for MemoryPosition<T>where
T: Copy,
impl<T> Eq for MemoryPosition<T>where
T: Eq,
impl<T> StructuralPartialEq for MemoryPosition<T>
Auto Trait Implementations§
impl<T> Freeze for MemoryPosition<T>where
T: Freeze,
impl<T> RefUnwindSafe for MemoryPosition<T>where
T: RefUnwindSafe,
impl<T> Send for MemoryPosition<T>where
T: Send,
impl<T> Sync for MemoryPosition<T>where
T: Sync,
impl<T> Unpin for MemoryPosition<T>where
T: Unpin,
impl<T> UnwindSafe for MemoryPosition<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> AsWeight<T> for Twhere
T: Clone + IntoWeight<T>,
impl<T> AsWeight<T> for Twhere
T: Clone + IntoWeight<T>,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<K, S> Identity<K> for Swhere
S: Borrow<K>,
K: Identifier,
impl<K, S> Identity<K> for Swhere
S: Borrow<K>,
K: Identifier,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more