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 Self
pub fn extend( &mut self, exprs: impl IntoIterator<Item = Expression>, ) -> &mut Self
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<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::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) -> Self
fn from(value: Expression) -> Self
Converts to this type from the input type.
Source§impl From<Selector> for LabelSelector
impl From<Selector> for LabelSelector
Source§impl FromIterator<Expression> for Selector
impl FromIterator<Expression> for Selector
Source§fn from_iter<T: IntoIterator<Item = Expression>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = Expression>>(iter: T) -> Self
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 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.
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