pub struct ExcludedAdvisor {
pub advisor: String,
pub status: AdvisorStatus,
pub reason: String,
}Expand description
One advisor left out of the plan, its standing when the plan was made, and why: its status, a capability it does not offer, or a budget already spent.
use majordomus_cli::reasoning::availability::{AdvisorState, AdvisorStatus, ModeResolution, ReasoningMode};
use majordomus_cli::reasoning::policy::{plan, ExcludedAdvisor, Materiality, PlanRequest};
fn advisor(id: &str, adapter: &str, status: &str) -> AdvisorState {
serde_json::from_value(serde_json::json!({
"id": id, "title": id, "transport": "api", "adapter": adapter,
"capabilities": ["independent_reasoning"], "status": status,
"reason": "present", "probe": "",
}))
.unwrap()
}
let mode = ModeResolution { mode: ReasoningMode::Standard, source: "default".into() };
let request = PlanRequest { materiality: Materiality::Material, ..Default::default() };
let states = [advisor("a", "x-api", "available"), advisor("b", "y-api", "available")];
let p = plan(&request, &mode, &states);
let left: &ExcludedAdvisor = &p.excluded[0];
assert_eq!((left.advisor.as_str(), left.status), ("b", AdvisorStatus::Available));
assert!(left.reason.contains("budget was spent"));Fields§
§advisor: StringThe advisor id.
status: AdvisorStatusIts standing when the plan was made.
reason: StringWhy it is not in the plan.
Trait Implementations§
Source§impl Clone for ExcludedAdvisor
impl Clone for ExcludedAdvisor
Source§fn clone(&self) -> ExcludedAdvisor
fn clone(&self) -> ExcludedAdvisor
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 ExcludedAdvisor
impl Debug for ExcludedAdvisor
Source§impl<'de> Deserialize<'de> for ExcludedAdvisor
impl<'de> Deserialize<'de> for ExcludedAdvisor
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
impl Eq for ExcludedAdvisor
Source§impl JsonSchema for ExcludedAdvisor
impl JsonSchema for ExcludedAdvisor
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 PartialEq for ExcludedAdvisor
impl PartialEq for ExcludedAdvisor
Source§fn eq(&self, other: &ExcludedAdvisor) -> bool
fn eq(&self, other: &ExcludedAdvisor) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for ExcludedAdvisor
impl Serialize for ExcludedAdvisor
impl StructuralPartialEq for ExcludedAdvisor
Auto Trait Implementations§
impl Freeze for ExcludedAdvisor
impl RefUnwindSafe for ExcludedAdvisor
impl Send for ExcludedAdvisor
impl Sync for ExcludedAdvisor
impl Unpin for ExcludedAdvisor
impl UnsafeUnpin for ExcludedAdvisor
impl UnwindSafe for ExcludedAdvisor
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.