pub struct Selector(/* private fields */);
Expand description
Perform selection on a list of expressions
Can be injected into WatchParams
or ListParams
.
Implementations§
Source§impl Selector
impl Selector
Sourcepub fn selects_all(&self) -> bool
pub fn selects_all(&self) -> bool
Indicates whether this label selector matches everything
Sourcepub fn extend(
&mut self,
exprs: impl IntoIterator<Item = Expression>,
) -> &mut Selector
pub fn extend( &mut self, exprs: impl IntoIterator<Item = Expression>, ) -> &mut Selector
Extend the list of expressions for the selector
use kube::core::{Selector, Expression};
use k8s_openapi::apimachinery::pkg::apis::meta::v1::LabelSelector;
let mut selector = Selector::default();
// Extend from expressions:
selector.extend(Expression::Equal("environment".into(), "production".into()));
selector.extend([Expression::Exists("bar".into()), Expression::Exists("foo".into())].into_iter());
// Extend from native selectors:
let label_selector: Selector = LabelSelector::default().try_into()?;
selector.extend(label_selector);
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Selector
impl<'de> Deserialize<'de> for Selector
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Selector, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Selector, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<Expression> for Selector
impl From<Expression> for Selector
Source§fn from(value: Expression) -> Selector
fn from(value: Expression) -> Selector
Converts to this type from the input type.
Source§impl FromIterator<(&'static str, &'static str)> for Selector
impl FromIterator<(&'static str, &'static str)> for Selector
Source§impl FromIterator<Expression> for Selector
impl FromIterator<Expression> for Selector
Source§fn from_iter<T>(iter: T) -> Selectorwhere
T: IntoIterator<Item = Expression>,
fn from_iter<T>(iter: T) -> Selectorwhere
T: IntoIterator<Item = Expression>,
Creates a value from an iterator. Read more
Source§impl IntoIterator for Selector
impl IntoIterator for Selector
Source§impl SelectorExt for Selector
impl SelectorExt for Selector
Source§impl Serialize for Selector
impl Serialize for Selector
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Source§impl TryFrom<LabelSelector> for Selector
impl TryFrom<LabelSelector> for Selector
Source§type Error = ParseExpressionError
type Error = ParseExpressionError
The type returned in the event of a conversion error.
Source§fn try_from(
value: LabelSelector,
) -> Result<Selector, <Selector as TryFrom<LabelSelector>>::Error>
fn try_from( value: LabelSelector, ) -> Result<Selector, <Selector as TryFrom<LabelSelector>>::Error>
Performs the conversion.
impl Eq for Selector
impl StructuralPartialEq for Selector
Auto Trait Implementations§
impl Freeze for Selector
impl RefUnwindSafe for Selector
impl Send for Selector
impl Sync for Selector
impl Unpin for Selector
impl UnwindSafe for Selector
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.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