pub struct Slot(/* private fields */);Expand description
Logical identifier for a controller slot.
A slot groups tasks that share a single execution lane. Controllers use slots for admission policy and queue behavior.
use solti_model::Slot;
let slot = Slot::new("build-pipeline").unwrap();
assert_eq!(slot.as_str(), "build-pipeline");
let slot = Slot::new("deploy").unwrap();
assert_eq!(format!("{slot}"), "deploy");Implementations§
Source§impl Slot
impl Slot
Sourcepub fn new(s: impl AsRef<str>) -> ModelResult<Self>
pub fn new(s: impl AsRef<str>) -> ModelResult<Self>
Creates a validated identifier.
§Errors
Returns crate::ModelError::Invalid when the value violates this identifier’s format.
Sourcepub fn into_inner(self) -> Arc<str>
pub fn into_inner(self) -> Arc<str>
Returns the underlying Arc<str>.
Source§impl Slot
impl Slot
Sourcepub fn validate_format(&self) -> Result<(), ModelError>
pub fn validate_format(&self) -> Result<(), ModelError>
Validates the slot.
§Errors
Returns ModelError::Invalid when the value is empty, too long, equal to "." or "..", or contains a byte outside [A-Za-z0-9._-].
§Example
use solti_model::Slot;
assert!(Slot::new("build.frontend").is_ok());
assert!(Slot::new("build/frontend").is_err());Trait Implementations§
Source§impl<'de> Deserialize<'de> for Slot
impl<'de> Deserialize<'de> for Slot
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserializes and validates the identifier.
impl Eq for Slot
Source§impl JsonSchema for Slot
impl JsonSchema for Slot
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl Ord for Slot
impl Ord for Slot
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for Slot
impl PartialOrd for Slot
impl StructuralPartialEq for Slot
Auto Trait Implementations§
impl Freeze for Slot
impl RefUnwindSafe for Slot
impl Send for Slot
impl Sync for Slot
impl Unpin for Slot
impl UnsafeUnpin for Slot
impl UnwindSafe for Slot
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