pub struct SelectorRequirement {
pub key: String,
pub operator: SelectorOperator,
pub values: Vec<String>,
}Expand description
Single set-based requirement for label matching.
{ key: "gpu", operator: In, values: ["a100", "h100"] } ⇒ runner must have label gpu ∈ {"a100", "h100"}
{ key: "zone", operator: Exists, values: [] } ⇒ runner must have label zone (any value)Used inside super::RunnerSelector::match_expressions.
Fields§
§key: StringLabel key to evaluate.
operator: SelectorOperatorComparison operator.
values: Vec<String>Values for In / NotIn.
Must be empty for Exists / DoesNotExist.
Implementations§
Source§impl SelectorRequirement
impl SelectorRequirement
Sourcepub fn validate(&self) -> ModelResult<()>
pub fn validate(&self) -> ModelResult<()>
Validate structural invariants.
keymust not be emptyIn/NotInmust have non-emptyvaluesExists/DoesNotExistmust have emptyvalues
Sourcepub fn in(key: impl Into<String>, values: Vec<String>) -> Self
pub fn in(key: impl Into<String>, values: Vec<String>) -> Self
Shorthand: require key ∈ values.
Sourcepub fn not_in(key: impl Into<String>, values: Vec<String>) -> Self
pub fn not_in(key: impl Into<String>, values: Vec<String>) -> Self
Shorthand: require key ∉ values.
Sourcepub fn does_not_exist(key: impl Into<String>) -> Self
pub fn does_not_exist(key: impl Into<String>) -> Self
Shorthand: require label key to NOT exist.
Trait Implementations§
Source§impl Clone for SelectorRequirement
impl Clone for SelectorRequirement
Source§fn clone(&self) -> SelectorRequirement
fn clone(&self) -> SelectorRequirement
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SelectorRequirement
impl Debug for SelectorRequirement
Source§impl<'de> Deserialize<'de> for SelectorRequirement
impl<'de> Deserialize<'de> for SelectorRequirement
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 PartialEq for SelectorRequirement
impl PartialEq for SelectorRequirement
Source§impl Serialize for SelectorRequirement
impl Serialize for SelectorRequirement
impl Eq for SelectorRequirement
impl StructuralPartialEq for SelectorRequirement
Auto Trait Implementations§
impl Freeze for SelectorRequirement
impl RefUnwindSafe for SelectorRequirement
impl Send for SelectorRequirement
impl Sync for SelectorRequirement
impl Unpin for SelectorRequirement
impl UnsafeUnpin for SelectorRequirement
impl UnwindSafe for SelectorRequirement
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