pub struct Writer<K: 'static + Lookup + Clone>{ /* private fields */ }
Expand description
A writable Store handle
This is exclusive since it’s not safe to share a single Store
between multiple reflectors.
In particular, Restarted
events will clobber the state of other connected reflectors.
Implementations§
source§impl<K: 'static + Lookup + Clone> Writer<K>
impl<K: 'static + Lookup + Clone> Writer<K>
sourcepub fn new(dyntype: K::DynamicType) -> Self
pub fn new(dyntype: K::DynamicType) -> Self
Creates a new Writer with the specified dynamic type.
If the dynamic type is default-able (for example when writer is used with
k8s_openapi
types) you can use Default
instead.
Creates a new Writer with the specified dynamic type and buffer size.
When the Writer is created through new_shared
, it will be able to
be subscribed. Stored objects will be propagated to all subscribers. The
buffer size is used for the underlying channel. An object is cleared
from the buffer only when all subscribers have seen it.
If the dynamic type is default-able (for example when writer is used with
k8s_openapi
types) you can use Default
instead.
sourcepub fn as_reader(&self) -> Store<K>
pub fn as_reader(&self) -> Store<K>
Return a read handle to the store
Multiple read handles may be obtained, by either calling as_reader
multiple times,
or by calling Store::clone()
afterwards.
sourcepub fn subscribe(&self) -> Option<ReflectHandle<K>>
pub fn subscribe(&self) -> Option<ReflectHandle<K>>
Return a handle to a subscriber
Multiple subscribe handles may be obtained, by either calling
subscribe
multiple times, or by calling clone()
This function returns a Some
when the Writer
is constructed through
Writer::new_shared
or store_shared
, and a None
otherwise.
sourcepub fn apply_watcher_event(&mut self, event: &Event<K>)
pub fn apply_watcher_event(&mut self, event: &Event<K>)
Applies a single watcher event to the store
Trait Implementations§
Auto Trait Implementations§
impl<K> Freeze for Writer<K>
impl<K> !RefUnwindSafe for Writer<K>
impl<K> Send for Writer<K>
impl<K> Sync for Writer<K>
impl<K> Unpin for Writer<K>
impl<K> !UnwindSafe for Writer<K>
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
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>
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>
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