Skip to main content

Explanation

Struct Explanation 

Source
#[non_exhaustive]
pub struct Explanation {
Show 17 fields pub instruction_id: Id, pub kind: MessageKind, pub execution_time: Timestamp, pub abnormal_condition: bool, pub actuator: Option<Id>, pub operation_mode: Option<(Id, Option<String>)>, pub factor: Option<f64>, pub power: Vec<PowerValue>, pub fill_rate: Option<f64>, pub supply_rate: Option<f64>, pub limits: Vec<(CommodityQuantity, Limits)>, pub sequence: Option<(Id, Id, Id, Duration)>, pub transition_duration: Duration, pub blocked_by: Vec<(Id, Option<String>)>, pub abnormal_only_misuse: bool, pub unresolved: Option<ResolveError>, pub notes: Vec<String>,
}
Expand description

What an instruction means, read against the descriptions that were sent.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§instruction_id: Id

The instruction’s own identifier.

§kind: MessageKind

Which kind of instruction it is.

§execution_time: Timestamp

When it takes effect. In the past means as soon as possible.

§abnormal_condition: bool

Whether it is an abnormal-condition instruction.

§actuator: Option<Id>

The actuator it addresses, for the control types that have them.

§operation_mode: Option<(Id, Option<String>)>

The operation mode it selects, with its diagnostic label where there is one.

§factor: Option<f64>

The factor it asks for.

§power: Vec<PowerValue>

The power that factor implies.

§fill_rate: Option<f64>

FRBC: how fast the store will fill, in fill-level units per second.

§supply_rate: Option<f64>

DDBC: the supply rate the mode will deliver.

§limits: Vec<(CommodityQuantity, Limits)>

PEBC: the bounds in force when the envelope starts.

§sequence: Option<(Id, Id, Id, Duration)>

PPBC: the profile, container and sequence it chose, and how long it takes.

§transition_duration: Duration

How long the move takes to take effect.

§blocked_by: Vec<(Id, Option<String>)>

Timers that have not finished and block the move this instruction asks for.

§abnormal_only_misuse: bool

Whether it uses something marked abnormal_condition_only without saying so.

§unresolved: Option<ResolveError>

Why the instruction could not be read against the description, if it could not.

An instruction naming an actuator nobody described, an operation mode that actuator does not have, or a factor outside [0, 1] has no power, no fill rate and no transition — and an Explanation that merely left those empty would be indistinguishable from one for an instruction that genuinely asks for zero watts. is_actionable is false whenever this is set.

§notes: Vec<String>

Anything else worth saying in a log line.

Implementations§

Source§

impl Explanation

Source

pub fn is_actionable(&self) -> bool

Whether this instruction can be carried out right now, as far as the description can tell.

Source

pub fn electric_power(&self) -> Option<f64>

The electrical power the instruction implies, if it names one.

Trait Implementations§

Source§

impl Clone for Explanation

Source§

fn clone(&self) -> Explanation

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 Explanation

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Display for Explanation

Source§

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

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Explanation

Source§

fn eq(&self, other: &Explanation) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Explanation

Auto Trait Implementations§

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<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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more