[−][src]Struct binjs::generic::mru::MRU
A structure used to access values with repeated patterns.
use binjs_shared::mru::{ MRU, Seen }; let mut mru = MRU::new(); assert_eq!(mru.access(&'a'), Seen::Never(0), "Introducing a"); assert_eq!(mru.access(&'a'), Seen::Age(0), "Just introduced a"); assert_eq!(mru.access(&'a'), Seen::Age(0), "Just accessed a"); assert_eq!(mru.access(&'b'), Seen::Never(1), "Introducing b"); assert_eq!(mru.access(&'b'), Seen::Age(0), "Just introduced b"); assert_eq!(mru.access(&'a'), Seen::Age(1), "Accessing previous a"); assert_eq!(mru.access(&'a'), Seen::Age(0), "Just accessed a again"); assert_eq!(mru.access(&'c'), Seen::Never(2), "Just introduced c"); assert_eq!(mru.access(&'a'), Seen::Age(1), "Accessing previous a, again"); assert_eq!(mru.access(&'a'), Seen::Age(0), "Accessing previous a, again"); assert_eq!(mru.access(&'b'), Seen::Age(2), "Accessing previous b");
Methods
impl<T> MRU<T> where
T: Eq + Clone,
[src]
T: Eq + Clone,
Auto Trait Implementations
impl<T> RefUnwindSafe for MRU<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for MRU<T> where
T: Send,
T: Send,
impl<T> Sync for MRU<T> where
T: Sync,
T: Sync,
impl<T> Unpin for MRU<T>
impl<T> UnwindSafe for MRU<T> where
T: RefUnwindSafe + UnwindSafe,
T: RefUnwindSafe + UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Downcast for T where
T: Any,
[src]
T: Any,
fn into_any(self: Box<T>) -> Box<dyn Any + 'static>
[src]
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
[src]
fn as_any(&self) -> &(dyn Any + 'static)
[src]
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
[src]
impl<T> DowncastSync for T where
T: Send + Sync + Any,
[src]
T: Send + Sync + Any,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,