pub struct ReadHandle<K, V, S = RandomState> { /* private fields */ }
Expand description

A read handle for the map.

This type allows for the creation of ReadGuards, which provide immutable access to the underlying data.

Implementations

Creates a new ReadGuard wrapped in a View, allowing safe access to the map.

Examples
let (write, read) = flashmap::new::<u32, u32>();

let guard = read.guard();

// The map should be empty since we added nothing to it.
assert!(guard.is_empty());

// Maybe do some more work with the guard

// The guard is released when dropped (you don't have to drop it explicitly)
drop(guard);

In order to see the most recent updates from the writer, a new guard needs to be created:

let (mut write, read) = flashmap::new::<String, String>();

let guard = read.guard();

// This key is not in the map yet
assert!(!guard.contains_key("ferris"));

write.guard().insert("ferris".to_owned(), "crab".to_owned());

// Since we're still using the same guard, the write isn't visible to us yet
assert!(!guard.contains_key("ferris"));

// Drop the old guard and get a new one
drop(guard);
let guard = read.guard();

// The write is now visible
assert_eq!(guard.get("ferris").unwrap(), "crab");

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.