pub struct ConfigWatch { /* private fields */ }Available on crate feature
k8s only.Expand description
One ConfigMap’s or Secret’s data, kept current. Cheap to clone; clones share it. The watch stops when the last clone is dropped.
Implementations§
Source§impl ConfigWatch
impl ConfigWatch
Sourcepub async fn config_map(
client: Client,
namespace: &str,
name: &str,
) -> Result<ConfigWatch, Error>
pub async fn config_map( client: Client, namespace: &str, name: &str, ) -> Result<ConfigWatch, Error>
Watch the ConfigMap name in namespace. Fails when it can’t be
read now (missing, or no permission).
Sourcepub async fn secret(
client: Client,
namespace: &str,
name: &str,
) -> Result<ConfigWatch, Error>
pub async fn secret( client: Client, namespace: &str, name: &str, ) -> Result<ConfigWatch, Error>
Watch the Secret name in namespace.
Sourcepub fn exists(&self) -> bool
pub fn exists(&self) -> bool
Whether the object exists (it may be deleted after the watch started; the last data is kept).
Sourcepub fn on_change(
&self,
f: impl Fn(&BTreeMap<String, String>) + Send + Sync + 'static,
)
pub fn on_change( &self, f: impl Fn(&BTreeMap<String, String>) + Send + Sync + 'static, )
Call f with the new data after each change.
Sourcepub fn apply_to_env(&self, prefix: &str)
pub fn apply_to_env(&self, prefix: &str)
Set every key starting with prefix (RWS_CONFIG_) as an
environment variable now and after each change, and have rws re-read
its settings (server_config::invalidate). Keys under the prefix
that disappear are left as they were.
Trait Implementations§
Source§impl Clone for ConfigWatch
impl Clone for ConfigWatch
Source§fn clone(&self) -> ConfigWatch
fn clone(&self) -> ConfigWatch
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Forget for ConfigWatch
impl Freeze for ConfigWatch
impl Move for ConfigWatch
impl RefUnwindSafe for ConfigWatch
impl Send for ConfigWatch
impl Sync for ConfigWatch
impl Unpin for ConfigWatch
impl UnsafeUnpin for ConfigWatch
impl UnwindSafe for ConfigWatch
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ServiceExt for T
impl<T> ServiceExt for T
Source§fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
Available on crate feature
map-response-body only.Apply a transformation to the response body. Read more
Source§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
Available on crate feature
trace only.High level tracing that classifies responses using HTTP status codes. Read more
Source§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
Available on crate feature
trace only.High level tracing that classifies responses using gRPC headers. Read more