Struct observable_tree::BTree[][src]

pub struct BTree { /* fields omitted */ }

BTree is where the informatio Sender is contained. Its inner implementation has a tuple containing the action to be taken as well as a oneshot channel to receive data. To start the BTree thread just execute BTree::start(buffer_size: usize). If you buffer_size is too short it may cause synchronization problems, so it should be well ajusted to your application needs.

Implementations

impl BTree[src]

pub fn start(buffer_size: usize) -> Self[src]

BTree::start(buffer_size: usize) is the entrypoint to start using BTree methods. It creates a thread containing the BTreeMap and keeps listening to entries.

pub async fn insert<V: Into<Types>>(
    &self,
    k: String,
    v: V
) -> Result<Option<Types>, String>
[src]

Method insert is equivalent to std::collection::BTreeMap insert, it returns None if the key does not exist and it returns Some(Types::_) with the previous value, if the key already exists.

pub async fn contains(&self, k: String) -> Result<bool, String>[src]

Method contains is equivalent to std::collection::BTreeMap contains_key, It checks if a key already exists in the BTree. If the key exists the return is Ok(true), if it doesn’t exist it returns Ok(false)

pub async fn get(&self, k: String) -> Result<Option<Types>, String>[src]

Method get is equivalent to std::collection::BTreeMap get, It returns the value contained at the key passed as argument. If no key is found the return is Ok(None), else it returns Ok(Some(Types::_)).

pub async fn len(&self) -> Result<usize, String>[src]

Method len is equivalent to std::collection::BTreeMap len, It returns the length of the btree as a usize.

pub async fn keys(&self) -> Result<Vec<String>, String>[src]

Method keys is equivalent to std::collection::BTreeMap keys, It returns a vector containing all the keys sorted. For BTree the keys are always Strings.

pub async fn values(&self) -> Result<Vec<Types>, String>[src]

Method values is equivalent to std::collection::BTreeMap values, It returns a vector containing all the values sorted by their respective keys order.

pub async fn remove(&self, k: String) -> Result<Option<Types>, String>[src]

Method remove is equivalent to std::collection::BTreeMap remove, It returns the value removed from the BTree for the key passed as argument. If no key is found the return is Ok(None), else it returns Ok(Some(Types::_)).

pub async fn remove_entry(&self, k: String) -> Result<Option<Types>, String>[src]

Method remove_entry is equivalent to std::collection::BTreeMap remove_entry, It returns the key and value removed from the BTree for the key passed as argument as a Option<Types::KeyValue(_,_)>. If no key is found the return is Ok(None),

Auto Trait Implementations

impl !RefUnwindSafe for BTree

impl Send for BTree

impl Sync for BTree

impl Unpin for BTree

impl !UnwindSafe for BTree

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.