[][src]Struct lucid_kv_client::LucidClient

pub struct LucidClient { /* fields omitted */ }

The main Client

Implementations

impl LucidClient[src]

pub fn new<U: AsRef<str> + ?Sized>(base_url: &U) -> Result<Self, Error>[src]

Build a basic Client. This is equivalent to Builder::new(url).build()

pub fn builder<'a, U: AsRef<str> + ?Sized>(base_url: &'a U) -> Builder<'a>[src]

Configure a Client with the Builder

pub async fn health_check<'_>(&'_ self) -> Result<(), Error>[src]

Health check

pub async fn put_raw<'_, '_, K: AsRef<str> + ?Sized, V: Into<Body>>(
    &'_ self,
    key: &'_ K,
    value: V
) -> Result<PutStatus, Error>
[src]

Store a string or bytes as a value for a key. Creates a new key if it does not exist

pub async fn get_raw<'_, '_, K: AsRef<str> + ?Sized>(
    &'_ self,
    key: &'_ K
) -> Result<Option<Bytes>, Error>
[src]

Gets raw bytes from a key's value

pub async fn delete<'_, '_, K: AsRef<str> + ?Sized>(
    &'_ self,
    key: &'_ K
) -> Result<bool, Error>
[src]

Delete a key's value. Returns true if the key existed and was actually deleted

pub async fn exists<'_, '_, K: AsRef<str> + ?Sized>(
    &'_ self,
    key: &'_ K
) -> Result<bool, Error>
[src]

Check if a key exists

pub async fn put<'_, '_, '_, K: AsRef<str> + ?Sized, V: Serialize + ?Sized>(
    &'_ self,
    key: &'_ K,
    value: &'_ V
) -> Result<PutStatus, Error>
[src]

Serialize a rust object and store as the value for a key

pub async fn get<'_, '_, K: AsRef<str> + ?Sized, V: DeserializeOwned>(
    &'_ self,
    key: &'_ K
) -> Result<Option<V>, Error>
[src]

Get the value for a key and deserialize it into a rust object

pub async fn lock<'_, '_, K: AsRef<str> + ?Sized>(
    &'_ self,
    key: &'_ K
) -> Result<bool, Error>
[src]

Lock a key. Returns false if the key is already locked and true otherwise

pub async fn unlock<'_, '_, K: AsRef<str> + ?Sized>(
    &'_ self,
    key: &'_ K
) -> Result<bool, Error>
[src]

Unlock a key. Returns false if the key is already unlocked and true otherwise

pub async fn increment<'_, '_, K: AsRef<str> + ?Sized>(
    &'_ self,
    key: &'_ K
) -> Result<(), Error>
[src]

Increment a key. Note the key's value must be like b"0" otherwise this will throw an Error::NonNumericValue

pub async fn decrement<'_, '_, K: AsRef<str> + ?Sized>(
    &'_ self,
    key: &'_ K
) -> Result<(), Error>
[src]

Decrement a key. See LucidClient::increment for more info.

pub async fn ttl<'_, '_, K: AsRef<str> + ?Sized>(
    &'_ self,
    key: &'_ K,
    duration: Duration
) -> Result<(), Error>
[src]

Add a "time to live" constraint to a key

pub async fn notifications_raw<'_, F, E>(
    &'_ self,
    handler: F
) -> Result<impl Stream<Item = Result<Notification<Bytes>, NotificationError<E>>>, Error> where
    F: ErrorHandler<Error, OutError = E>,
    E: Display + Debug + Send + Sync + 'static, 
[src]

Get raw notification blobs

pub async fn notifications<'_, F, T, E>(
    &'_ self,
    handler: F
) -> Result<impl Stream<Item = Result<Notification<T>, NotificationError<E>>>, Error> where
    F: ErrorHandler<Error, OutError = E>,
    E: Display + Debug + Send + Sync + 'static,
    T: DeserializeOwned
[src]

Get notifications and deserialize them into objects

Trait Implementations

impl Clone for LucidClient[src]

impl Debug for LucidClient[src]

Auto Trait Implementations

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.