pub struct Vocabulary {
pub version: u64,
pub source: String,
pub count: usize,
pub obligations: Vec<Obligation>,
}Expand description
The vocabulary the distribution ships: every token there is.
count is measured from obligations rather than written down, so a token added to
the file is counted by the same act that declares it.
use majordomus_cli::capability::builtin::obligations::Vocabulary;
let v: Vocabulary = serde_json::from_str(
r#"{"version":1,"source":"/opt/majordomus/share/obligations.yaml","count":1,
"obligations":[{"id":"commit","title":"The work is committed",
"summary":"In the branch's history, not the working tree.",
"discharged_by":"git","remote":false}]}"#,
)
.unwrap();
assert_eq!(v.count, v.obligations.len());
assert_eq!(v.version, 1, "the only shape this reader accepts");Fields§
§version: u64The file’s own format version. 1 is the only one this reader accepts.
source: StringWhere it was read from, absolute: the distribution’s share directory, which is not necessarily inside the repository.
count: usizeHow many tokens there are. No number anywhere is written down.
obligations: Vec<Obligation>Every token, in the order the file declares them.
Trait Implementations§
Source§impl Clone for Vocabulary
impl Clone for Vocabulary
Source§fn clone(&self) -> Vocabulary
fn clone(&self) -> Vocabulary
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 Vocabulary
impl Debug for Vocabulary
Source§impl<'de> Deserialize<'de> for Vocabulary
impl<'de> Deserialize<'de> for Vocabulary
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 Vocabulary
Source§impl JsonSchema for Vocabulary
impl JsonSchema for Vocabulary
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 Vocabulary
impl PartialEq for Vocabulary
Source§fn eq(&self, other: &Vocabulary) -> bool
fn eq(&self, other: &Vocabulary) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for Vocabulary
impl Serialize for Vocabulary
impl StructuralPartialEq for Vocabulary
Auto Trait Implementations§
impl Freeze for Vocabulary
impl RefUnwindSafe for Vocabulary
impl Send for Vocabulary
impl Sync for Vocabulary
impl Unpin for Vocabulary
impl UnsafeUnpin for Vocabulary
impl UnwindSafe for Vocabulary
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.