Trait kube::runtime::Predicate

source ·
pub trait Predicate<K> {
    // Required method
    fn hash_property(&self, obj: &K) -> Option<u64>;

    // Provided methods
    fn fallback<F>(self, f: F) -> Fallback<Self, F>
       where F: Predicate<K>,
             Self: Sized { ... }
    fn combine<F>(self, f: F) -> Combine<Self, F>
       where F: Predicate<K>,
             Self: Sized { ... }
}
Available on crate feature runtime only.
Expand description

A predicate is a hasher of Kubernetes objects stream filtering

Required Methods§

source

fn hash_property(&self, obj: &K) -> Option<u64>

A predicate only needs to implement optional hashing when keys exist

Provided Methods§

source

fn fallback<F>(self, f: F) -> Fallback<Self, F>
where F: Predicate<K>, Self: Sized,

Returns a Predicate that falls back to an alternate property if the first does not exist

§Usage
use kube::runtime::{predicates, Predicate};
let pred = predicates::generation.fallback(predicates::resource_version);
blah::<Pod>(pred);
source

fn combine<F>(self, f: F) -> Combine<Self, F>
where F: Predicate<K>, Self: Sized,

Returns a Predicate that combines all available hashes

§Usage
use kube::runtime::{predicates, Predicate};
let pred = predicates::labels.combine(predicates::annotations);
blah::<Pod>(pred);

Implementors§

source§

impl<K, F> Predicate<K> for F
where F: Fn(&K) -> Option<u64>,