Skip to main content

ConcurrentBTreeMap

Struct ConcurrentBTreeMap 

Source
pub struct ConcurrentBTreeMap<K, V> { /* private fields */ }
Expand description

A concurrent map that can be used to store key-value pairs in a sorted order.

§Examples

use handy::collections::{ConcurrentBTreeMap, Map};

let map: ConcurrentBTreeMap<usize, u32> = ConcurrentBTreeMap::new();

§Errors

Trait Implementations§

Source§

impl<K: Debug, V: Debug> Debug for ConcurrentBTreeMap<K, V>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<K, V> Default for ConcurrentBTreeMap<K, V>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<K, V> Map<K, V> for ConcurrentBTreeMap<K, V>
where K: Eq + Ord + Send + Sync, V: Copy,

Source§

fn new() -> Self

Creates a new concurrent map.

§Examples
use handy::collections::{ConcurrentBTreeMap, Map};

let map: ConcurrentBTreeMap<usize, u32> = ConcurrentBTreeMap::new();
Source§

fn insert(&self, key: K, value: V) -> Result<(), ConcurrentCollectionError>

Inserts a key-value pair into the map.

§Examples
use handy::collections::{ConcurrentBTreeMap, Map};

let map: ConcurrentBTreeMap<usize, u32> = ConcurrentBTreeMap::new();

map.insert(1, 2).unwrap();
§Errors
Source§

fn get(&self, key: &K) -> Option<V>

Retrieves the value associated with the specified key.

§Examples
use handy::collections::{ConcurrentBTreeMap, Map};

let map: ConcurrentBTreeMap<usize, u32> = ConcurrentBTreeMap::new();

if let Some(value) = map.get(&1) {
    // do something
}
Source§

fn contains_key(&self, key: &K) -> bool

Checks if the map contains the specified key.

§Examples
use handy::collections::{ConcurrentBTreeMap, Map};

let map: ConcurrentBTreeMap<usize, u32> = ConcurrentBTreeMap::new();

if map.contains_key(&1) {
    // do something
}
Source§

fn remove(&self, key: &K) -> Option<V>

Removes the value associated with the specified key.

§Examples
use handy::collections::{ConcurrentBTreeMap, Map};

let map: ConcurrentBTreeMap<usize, u32> = ConcurrentBTreeMap::new();

map.remove(&1).unwrap();
Source§

fn len(&self) -> usize

Returns the number of key-value pairs in the map.

§Example
use handy::collections::{ConcurrentBTreeMap, Map};

let map: ConcurrentBTreeMap<usize, u32> = ConcurrentBTreeMap::new();

map.insert(1, 2).unwrap();
assert_eq!(map.len(), 1);
Source§

fn is_empty(&self) -> bool

Checks if the map is empty.

§Example
use handy::collections::{ConcurrentBTreeMap, Map};

let map: ConcurrentBTreeMap<usize, u32> = ConcurrentBTreeMap::new();

map.insert(1, 2).unwrap();
assert!(!map.is_empty());

Auto Trait Implementations§

§

impl<K, V> Freeze for ConcurrentBTreeMap<K, V>

§

impl<K, V> RefUnwindSafe for ConcurrentBTreeMap<K, V>

§

impl<K, V> Send for ConcurrentBTreeMap<K, V>
where K: Send + Sync, V: Send + Sync,

§

impl<K, V> Sync for ConcurrentBTreeMap<K, V>
where K: Send + Sync, V: Send + Sync,

§

impl<K, V> Unpin for ConcurrentBTreeMap<K, V>

§

impl<K, V> UnsafeUnpin for ConcurrentBTreeMap<K, V>

§

impl<K, V> UnwindSafe for ConcurrentBTreeMap<K, V>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.