[][src]Struct yocto_client::Store

pub struct Store { /* fields omitted */ }

Represents a key-value store

Methods

impl Store[src]

pub fn new(connection: &str) -> Result<Store, Box<dyn Error>>[src]

Returns a new yocto store

Arguments

  • connection - A string slice that holds the endpoint of the yocto server

pub fn get(&self, key: &str) -> Result<Option<String>, Box<dyn Error>>[src]

Locates the given key inside the database and returns an Ok with the corresponding value if existing or an None if not.

Arguments

  • key - A string slice that holds the key to look up

pub fn insert(
    &self,
    key: &str,
    value: &str
) -> Result<Option<String>, Box<dyn Error>>
[src]

Inserts a value for a specified key. Returns the old value if existent.

Arguments

  • key - A string slice that holds the key to insert the value for
  • value - The value to insert

pub fn remove(&self, key: &str) -> Result<Option<String>, Box<dyn Error>>[src]

Removes the value corresponding to a key. Returns Err if key is not found.

Arguments

  • key - A string slice that holds the key to delete the value for

pub fn clear(&self) -> Result<Option<String>, Box<dyn Error>>[src]

Removes all key-value pairs from the database

Auto Trait Implementations

impl Send for Store

impl Sync for Store

Blanket Implementations

impl<T> From for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

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

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

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

The type returned in the event of a conversion error.