pub struct Cache { /* private fields */ }Expand description
Cache will watch root node and it’s children nodes recursively
use futures::StreamExt;
use zookeeper_cache::CacheBuilder;
async fn dox() -> zookeeper_cache::Result<()>{
let (cache,mut stream) = CacheBuilder::default().build("localhost:2181").await?;
tokio::spawn(async move{
while let Some(_event) = stream.next().await{
// handle event
}
});
cache.get("/test").await;
Ok(())
}Implementations§
Source§impl Cache
impl Cache
pub async fn new( addr: impl Into<String>, builder: CacheBuilder, ) -> Result<(Self, impl Stream<Item = Event>)>
Sourcepub async fn get(&self, path: &str) -> Option<SharedChildData>
pub async fn get(&self, path: &str) -> Option<SharedChildData>
Get data and stat through path
use zookeeper_cache::CacheBuilder;
async fn dox()->zookeeper_cache::Result<()>{
let (cache, _stream) = CacheBuilder::default().build("localhost:2181").await?;
cache.get("/test").await;
Ok(())
}Trait Implementations§
Auto Trait Implementations§
impl Freeze for Cache
impl !RefUnwindSafe for Cache
impl Send for Cache
impl Sync for Cache
impl Unpin for Cache
impl !UnwindSafe for Cache
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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