pub struct SharedCodeDictionary<T: Eq + Hash> { /* private fields */ }Available on crate feature
std only.Expand description
Wraps CodeDictionary in an Arc<RwLock>> for shared access.
Implementations§
pub fn new() -> SharedCodeDictionary<T>
Sourcepub fn lookup_value(&self, value: &T) -> Option<u32>
pub fn lookup_value(&self, value: &T) -> Option<u32>
Looks up a code for a specific value
Sourcepub fn get_code(&mut self, value: &T) -> (bool, u32)
pub fn get_code(&mut self, value: &T) -> (bool, u32)
Returns the code for the specified value and if a new code was generated for the value (first time seeing the value).
pub fn read_code<F: FnOnce() -> Result<T, E>, E>( &mut self, code: u32, value_producer: F, ) -> Result<T, E>
Trait Implementations§
Source§fn clone(&self) -> SharedCodeDictionary<T>
fn clone(&self) -> SharedCodeDictionary<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§fn default() -> SharedCodeDictionary<T>
fn default() -> SharedCodeDictionary<T>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
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