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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)