pub struct ExplainInput {
pub uri: String,
pub request: CompileInput,
}Expand description
The input of devcontext.explain: one identifier, and the request to judge it under.
The request is not optional context for the question — it is half of the question.
“Why is this ADR not in my context” has no answer in the abstract: it is in or out of a
particular compiled answer, and “excluded for budget” is only actionable when the
budget it did not fit in is known. So the same fields compile takes are flattened in
here, which also means the wire form is one flat object rather than a nested request,
and the command line can share its flags.
use majordomus_cli::devcontext::ExplainInput;
use serde_json::json;
// flattened: the request's fields sit beside `uri`, not under it
let input: ExplainInput = serde_json::from_value(json!({
"uri": "majordomus://adr/0052",
"budget_tokens": 2_000,
"max_depth": 1,
})).unwrap();
assert_eq!(input.uri, "majordomus://adr/0052");
assert_eq!(input.request.budget_tokens, Some(2_000));
assert_eq!(input.request.max_depth, Some(1));
// and the identifier alone is a complete question, judged under the default request
let bare: ExplainInput = serde_json::from_value(json!({"uri": "majordomus://adr/0052"}))
.unwrap();
assert_eq!(bare.request, Default::default());Fields§
§uri: StringThe canonical identifier to explain.
request: CompileInputThe request it would be compiled under; the same fields as devcontext.compile.
Trait Implementations§
Source§impl BenchmarkCases for ExplainInput
impl BenchmarkCases for ExplainInput
Source§fn benchmark_cases(ctx: &CaseContext<'_>) -> Vec<NamedCase<Self>>
fn benchmark_cases(ctx: &CaseContext<'_>) -> Vec<NamedCase<Self>>
The cases, in a stable order. An empty list means “nothing to benchmark in this
repository”, which the coverage check reports as missing.
Source§fn benchmark_cases_json(ctx: &CaseContext<'_>) -> Vec<NamedCase<Value>>
fn benchmark_cases_json(ctx: &CaseContext<'_>) -> Vec<NamedCase<Value>>
The cases as JSON, the shape every runner serialises from.
Source§impl Clone for ExplainInput
impl Clone for ExplainInput
Source§fn clone(&self) -> ExplainInput
fn clone(&self) -> ExplainInput
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 ExplainInput
impl Debug for ExplainInput
Source§impl Default for ExplainInput
impl Default for ExplainInput
Source§fn default() -> ExplainInput
fn default() -> ExplainInput
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ExplainInput
impl<'de> Deserialize<'de> for ExplainInput
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 ExplainInput
impl JsonSchema for ExplainInput
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 ExplainInput
impl PartialEq for ExplainInput
Source§fn eq(&self, other: &ExplainInput) -> bool
fn eq(&self, other: &ExplainInput) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for ExplainInput
impl Serialize for ExplainInput
impl StructuralPartialEq for ExplainInput
Auto Trait Implementations§
impl Freeze for ExplainInput
impl RefUnwindSafe for ExplainInput
impl Send for ExplainInput
impl Sync for ExplainInput
impl Unpin for ExplainInput
impl UnsafeUnpin for ExplainInput
impl UnwindSafe for ExplainInput
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