pub enum SubjectKind {
Claim,
Rule,
Feature,
Command,
Capability,
Mcp,
UseCase,
}Expand description
What kind of declaration a subject is. The declaration order is the order the committed index lists its kinds in.
use majordomus_cli::evidence::subject::SubjectKind;
let key = SubjectKind::Command.key("commit plan");
assert_eq!(key, "command:commit plan");
assert_eq!(SubjectKind::parse(&key), Some((SubjectKind::Command, "commit plan")));
assert_eq!(serde_json::to_value(SubjectKind::UseCase).unwrap(), "use_case");Variants§
Claim
A claim of docs/CLAIMS.yaml.
Rule
A rule of the layer, by id without its version.
Feature
A feature under .ai/repo/features/.
Command
A public shell command or a native command path, its words joined by one space.
Capability
A builtin capability of the executable.
Mcp
An MCP tool name: an alias of its capability.
UseCase
A use case under .ai/repo/use-cases/.
Implementations§
Source§impl SubjectKind
impl SubjectKind
Sourcepub const ALL: [SubjectKind; 7]
pub const ALL: [SubjectKind; 7]
Every kind, in declaration order.
Sourcepub fn prefix(self) -> &'static str
pub fn prefix(self) -> &'static str
The word a key starts with: the kind’s serialised name.
use majordomus_cli::evidence::subject::SubjectKind;
assert_eq!(SubjectKind::Claim.prefix(), "claim");
assert_eq!(SubjectKind::UseCase.prefix(), "use_case");Sourcepub fn key(self, id: &str) -> String
pub fn key(self, id: &str) -> String
The key of the subject of this kind with this id: <prefix>:<id>.
use majordomus_cli::evidence::subject::SubjectKind;
assert_eq!(SubjectKind::Rule.key("project.scope"), "rule:project.scope");Sourcepub fn parse(key: &str) -> Option<(SubjectKind, &str)>
pub fn parse(key: &str) -> Option<(SubjectKind, &str)>
Read a key back into its kind and its id, or None when it is not a subject key.
The key splits at its first :, so an id may carry colons and spaces of its own;
the prefix must be a kind’s, and the id must not be empty.
use majordomus_cli::evidence::subject::SubjectKind;
assert_eq!(
SubjectKind::parse("command:commit plan"),
Some((SubjectKind::Command, "commit plan"))
);
assert_eq!(SubjectKind::parse("gate:x"), None, "not a kind");
assert_eq!(SubjectKind::parse("claim:"), None, "no id");
assert_eq!(SubjectKind::parse("nonsense"), None);Sourcepub fn section(self) -> Option<&'static str>
pub fn section(self) -> Option<&'static str>
The site section a subject of this kind has its page in, or None when the kind has
no page of its own (a rule, an MCP alias).
use majordomus_cli::evidence::subject::SubjectKind;
assert_eq!(SubjectKind::UseCase.section(), Some("use-cases"));
assert_eq!(SubjectKind::Mcp.section(), None);Trait Implementations§
Source§impl Clone for SubjectKind
impl Clone for SubjectKind
Source§fn clone(&self) -> SubjectKind
fn clone(&self) -> SubjectKind
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for SubjectKind
Source§impl Debug for SubjectKind
impl Debug for SubjectKind
Source§impl<'de> Deserialize<'de> for SubjectKind
impl<'de> Deserialize<'de> for SubjectKind
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 SubjectKind
Source§impl JsonSchema for SubjectKind
impl JsonSchema for SubjectKind
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 moreSource§impl Ord for SubjectKind
impl Ord for SubjectKind
Source§fn cmp(&self, other: &SubjectKind) -> Ordering
fn cmp(&self, other: &SubjectKind) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for SubjectKind
impl PartialEq for SubjectKind
Source§fn eq(&self, other: &SubjectKind) -> bool
fn eq(&self, other: &SubjectKind) -> bool
self and other values to be equal, and is used by ==.Source§impl PartialOrd for SubjectKind
impl PartialOrd for SubjectKind
Source§impl Serialize for SubjectKind
impl Serialize for SubjectKind
impl StructuralPartialEq for SubjectKind
Auto Trait Implementations§
impl Freeze for SubjectKind
impl RefUnwindSafe for SubjectKind
impl Send for SubjectKind
impl Sync for SubjectKind
impl Unpin for SubjectKind
impl UnsafeUnpin for SubjectKind
impl UnwindSafe for SubjectKind
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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
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.