pub struct PriorityRule {
pub command: String,
pub provider: Option<ProviderConfig>,
pub model: Option<String>,
pub priority: i32,
pub weekdays: Option<Vec<String>>,
pub hours: Option<Vec<String>>,
}Fields§
§command: String§provider: Option<ProviderConfig>§model: Option<String>§priority: i32§weekdays: Option<Vec<String>>Weekday ranges in “start-end” format (0=Sun, 1=Mon, …, 6=Sat, inclusive).
e.g. ["1-5"] means Monday through Friday.
hours: Option<Vec<String>>Hour ranges in “start-end” format, half-open [start, end), 0-48.
e.g. ["21-27"] means 21:00 to 03:00 next day.
Implementations§
Source§impl PriorityRule
impl PriorityRule
pub fn resolve_provider(&self) -> Option<&str>
pub fn matches( &self, command: &str, provider: Option<&str>, model: Option<&str>, ) -> bool
Sourcepub fn matches_at(
&self,
command: &str,
provider: Option<&str>,
model: Option<&str>,
now: &DateTime<Local>,
) -> bool
pub fn matches_at( &self, command: &str, provider: Option<&str>, model: Option<&str>, now: &DateTime<Local>, ) -> bool
Like matches, but also evaluates weekdays/hours schedule conditions
against the given local timestamp.
Sourcepub fn schedule_specificity(&self) -> u8
pub fn schedule_specificity(&self) -> u8
Returns the number of schedule axes constrained by this rule (0, 1, or 2). Used for conflict resolution: rules with more constraints win over less specific ones.
Trait Implementations§
Source§impl Clone for PriorityRule
impl Clone for PriorityRule
Source§fn clone(&self) -> PriorityRule
fn clone(&self) -> PriorityRule
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 PriorityRule
impl Debug for PriorityRule
Source§impl<'de> Deserialize<'de> for PriorityRule
impl<'de> Deserialize<'de> for PriorityRule
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 PriorityRule
impl PartialEq for PriorityRule
Source§impl Serialize for PriorityRule
impl Serialize for PriorityRule
impl Eq for PriorityRule
impl StructuralPartialEq for PriorityRule
Auto Trait Implementations§
impl Freeze for PriorityRule
impl RefUnwindSafe for PriorityRule
impl Send for PriorityRule
impl Sync for PriorityRule
impl Unpin for PriorityRule
impl UnsafeUnpin for PriorityRule
impl UnwindSafe for PriorityRule
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