pub struct ClientState { /* private fields */ }
Expand description
A struct which goal is to give a generic access to attach any state to a client instance
It is internally used to cache RedisGraph metadata.
Implementations§
Source§impl ClientState
impl ClientState
Sourcepub fn get_state<S: Default + Send + Sync + 'static>(
&self,
key: &str,
) -> Result<Option<&S>>
pub fn get_state<S: Default + Send + Sync + 'static>( &self, key: &str, ) -> Result<Option<&S>>
Get state with a specific type S
for a specific key
§Return
Casted state to the required type or Ok(None) if key
has not been found.
If the state does not already exists, it is created on the fly
by calling S::default()
§Errors
An error if an entry has been found for the key
but this entry cannot be
downcasted to the required type.
Trait Implementations§
Source§impl Default for ClientState
impl Default for ClientState
Source§fn default() -> ClientState
fn default() -> ClientState
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ClientState
impl !RefUnwindSafe for ClientState
impl Send for ClientState
impl Sync for ClientState
impl Unpin for ClientState
impl !UnwindSafe for ClientState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more