pub struct ConsultationView {
pub id: String,
pub plan: String,
pub advisor: String,
pub status: ConsultationStatus,
pub stance: Option<Stance>,
pub conclusion: Option<String>,
pub diagnostic: Option<String>,
}Expand description
One consultation, as the state reports it.
A failed consultation is reported as plainly as a completed one: its status and the adapter’s diagnostic stand where the advice would, so degradation is visible rather than silently absent.
use majordomus_cli::reasoning::record::ConsultationStatus;
use majordomus_cli::reasoning::state::{derive, ConsultationView};
use majordomus_cli::reasoning::store::Loaded;
let mut loaded = Loaded::default();
loaded.records.push(rec("consultation-1", 1, json!({
"kind": "consultation", "plan": "plan-0", "advisor": "alpha",
"status": "timeout", "diagnostic": "timeout: no answer in 60s",
})));
let state = derive(&loaded, None);
let view: &ConsultationView = &state.consultations[0];
assert_eq!(view.status, ConsultationStatus::Timeout);
assert_eq!(view.conclusion, None);
assert_eq!(view.diagnostic.as_deref(), Some("timeout: no answer in 60s"));
assert_eq!(state.totals.consultations_failed, 1);Fields§
§id: StringRecord id.
plan: StringThe plan that selected it.
advisor: StringThe advisor.
status: ConsultationStatusHow it ended.
stance: Option<Stance>Where the advice stands.
conclusion: Option<String>The advice, summarised.
diagnostic: Option<String>The adapter’s diagnostic, for a failure.
Trait Implementations§
Source§impl Clone for ConsultationView
impl Clone for ConsultationView
Source§fn clone(&self) -> ConsultationView
fn clone(&self) -> ConsultationView
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 ConsultationView
impl Debug for ConsultationView
Source§impl<'de> Deserialize<'de> for ConsultationView
impl<'de> Deserialize<'de> for ConsultationView
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 JsonSchema for ConsultationView
impl JsonSchema for ConsultationView
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 moreAuto Trait Implementations§
impl Freeze for ConsultationView
impl RefUnwindSafe for ConsultationView
impl Send for ConsultationView
impl Sync for ConsultationView
impl Unpin for ConsultationView
impl UnsafeUnpin for ConsultationView
impl UnwindSafe for ConsultationView
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