Skip to main content

RuleBook

Struct RuleBook 

Source
pub struct RuleBook { /* private fields */ }
Expand description

The loaded rule packs and the source registry.

Implementations§

Source§

impl RuleBook

Source

pub fn bundled_texts() -> impl Iterator<Item = (&'static str, &'static str)>

The bundled source register and packs as (path, text), in a fixed order — for a fingerprint of the rules a decision was made under.

Source

pub fn bundled() -> Result<Self, Vec<RuleProblem>>

The rule packs shipped in rules/.

§Errors

Every problem in the bundled packs (a release never ships with any; the gate checks).

Source

pub fn parse( sources: &str, packs: &[(&str, &str)], ) -> Result<Self, Vec<RuleProblem>>

Parses a source registry and named packs, collecting every problem.

§Errors

Unknown or incomplete sources, malformed entries, overlapping validity.

Source

pub fn sources(&self) -> impl Iterator<Item = &Source>

Every registered source.

Source

pub fn source_of(&self, entry: &Entry) -> Option<&Source>

The source an entry cites.

Source

pub fn entries(&self) -> impl Iterator<Item = &Entry>

Every entry, by rule id.

Source

pub fn entry(&self, rule: &str, day: Date) -> Result<&Entry, Missing>

The entry of rule in force for delivery day day.

§Errors

Missing if none applies.

Source

pub fn da_mtu(&self, day: Date) -> Result<(u16, &Entry), Missing>

The day-ahead market time unit in minutes for day.

§Errors

Missing if no entry applies or it has the wrong shape.

Source

pub fn gate( &self, rule: &str, day: Date, ) -> Result<(OffsetDateTime, &Entry), Missing>

The instant of gate or publication rule for delivery day day.

§Errors

Missing if no entry applies, it is not a gate, or the instant falls outside the calendar.

Source

pub fn da_price_limits( &self, day: Date, ) -> Result<(EurPerMwh, EurPerMwh, &Entry), Missing>

The harmonised day-ahead price limits for day.

§Errors

Missing if no entry applies.

Source

pub fn alarm( &self, rule: &str, day: Date, ) -> Result<(&AlarmDef, &Entry), Missing>

The alarm type rule in force on day.

§Errors

Missing if no entry applies or it is not an alarm.

Source

pub fn rate(&self, rule: &str, day: Date) -> Result<(u32, u32, &Entry), Missing>

A rate rule (count per window_secs) in force on day.

§Errors

Missing if no entry applies or it is not a rate.

Source

pub fn seconds(&self, rule: &str, day: Date) -> Result<(u32, &Entry), Missing>

A duration rule in seconds in force on day.

§Errors

Missing if no entry applies or it is not a duration.

Source

pub fn granularity( &self, rule: &str, day: Date, ) -> Result<(Granularity, &Entry), Missing>

A granularity rule (da.volume-granularity, da.price-granularity) for day.

§Errors

Missing if no entry applies.

Trait Implementations§

Source§

impl Clone for RuleBook

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RuleBook

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Forget for RuleBook

§

impl Freeze for RuleBook
where *const LeafNode<String, Source> is !null: Freeze, PhantomData<(Owned, LeafOrInternal)>: Freeze, PhantomData<Box<(String, Source)>>: Freeze, *const LeafNode<String, Vec<Entry>> is !null: Freeze, PhantomData<Box<(String, Vec<Entry>)>>: Freeze,

§

impl Move for RuleBook

§

impl RefUnwindSafe for RuleBook

§

impl Send for RuleBook
where NodeRef<Owned, String, Source, LeafOrInternal>: Send, BoxRaw<(String, Source)>: Send, NodeRef<Owned, String, Vec<Entry>, LeafOrInternal>: Send, BoxRaw<(String, Vec<Entry>)>: Send,

§

impl Sync for RuleBook
where NodeRef<Owned, String, Source, LeafOrInternal>: Sync, BoxRaw<(String, Source)>: Sync, NodeRef<Owned, String, Vec<Entry>, LeafOrInternal>: Sync, BoxRaw<(String, Vec<Entry>)>: Sync,

§

impl Unpin for RuleBook
where *const LeafNode<String, Source> is !null: Unpin, Box<(String, Source)>: Unpin, *const LeafNode<String, Vec<Entry>> is !null: Unpin, Box<(String, Vec<Entry>)>: Unpin,

§

impl UnsafeUnpin for RuleBook
where *const LeafNode<String, Source> is !null: UnsafeUnpin, PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin, PhantomData<Box<(String, Source)>>: UnsafeUnpin, *const LeafNode<String, Vec<Entry>> is !null: UnsafeUnpin, PhantomData<Box<(String, Vec<Entry>)>>: UnsafeUnpin,

§

impl UnwindSafe for RuleBook

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<U> As for U

Source§

fn as_<T>(self) -> T
where T: CastFrom<U>, U: Sized,

Casts self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.