pub struct Seed {
pub uri: String,
pub kind: String,
pub from: String,
pub resolved: Option<String>,
}Expand description
What the request asked to compile a context about.
A seed is the request echoed back after resolution, and it is in the answer so that a
caller can see what their short name turned into. from names the request field it came
from — issue, milestone, uris, paths, intent — which is how the same identifier
arriving two ways stays two seeds rather than one.
resolved is populated only when resolution actually changed something: name a
milestone by its slug and it carries the canonical identity, name it by that identity and
there was nothing to resolve, so the field is absent. A path and an intent are not
resolved against the index at all — their uri is the literal the request gave.
use majordomus_cli::devcontext::Seed;
use serde_json::json;
// named by a slug: the answer says what it became
let by_slug: Seed = serde_json::from_value(json!({
"uri": "majordomus://milestone/M04",
"kind": "milestone",
"from": "milestone",
"resolved": "M04",
})).unwrap();
assert_eq!(by_slug.resolved.as_deref(), Some("M04"));
// named canonically: nothing was resolved, so nothing is reported
let canonical: Seed = serde_json::from_value(json!({
"uri": "majordomus://issue/I0301",
"kind": "issue",
"from": "issue",
})).unwrap();
assert!(canonical.resolved.is_none());
// and a path is carried verbatim: its `uri` is not a canonical identifier at all
let path: Seed = serde_json::from_value(json!({
"uri": "apps/majordomus-cli/src",
"kind": "path",
"from": "paths",
})).unwrap();
assert!(!path.uri.starts_with("majordomus://"));
assert_eq!(path.from, "paths", "which request field it came from");Fields§
§uri: StringThe canonical identifier of the seed, or the literal the request gave for an intent or a path.
kind: Stringissue, milestone, path, intent, or the kind of the object named.
from: StringWhere it came from: which field of the request.
resolved: Option<String>What the compiler resolved it to, when the request named something by a short name.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Seed
impl<'de> Deserialize<'de> for Seed
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>,
impl Eq for Seed
Source§impl JsonSchema for Seed
impl JsonSchema for Seed
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreimpl StructuralPartialEq for Seed
Auto Trait Implementations§
impl Freeze for Seed
impl RefUnwindSafe for Seed
impl Send for Seed
impl Sync for Seed
impl Unpin for Seed
impl UnsafeUnpin for Seed
impl UnwindSafe for Seed
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
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
key and return true if they are equal.