pub struct OperatorClaim {
pub subject: String,
pub created_at: OffsetDateTime,
pub creates: Vec<Allowance>,
}Expand description
One bot.did.operator record read out of the operator’s repository.
Fields§
§subject: StringThe subject field: the DID the claim names.
created_at: OffsetDateTimeWhen the operator wrote the claim.
creates: Vec<Allowance>What may be created beneath the subject. Only meaningful in the operator’s own repository; a hosted account’s record carries none.
Implementations§
Source§impl OperatorClaim
impl OperatorClaim
Sourcepub fn new(subject: impl Into<String>, created_at: OffsetDateTime) -> Self
pub fn new(subject: impl Into<String>, created_at: OffsetDateTime) -> Self
A claim on subject with no credentials and no allowances.
Sourcepub fn from_json(value: &Value) -> Option<Self>
pub fn from_json(value: &Value) -> Option<Self>
Parses a bot.did.operator record’s value object into a claim.
None for anything that is not one: a missing required field, a
field of the wrong JSON type, or a timestamp that is not RFC 3339.
A record that is present but malformed reads as no claim at all,
deliberately — a reader must not interpret a foreign repository’s
record charitably, and “the repository answered with something this
reader cannot understand” is not the same fact as “the repository
could not be reached”, which is why this returns Option rather
than the error a fetch reports.
An unknown field is ignored, and an entry of creates this reader
cannot parse is dropped rather than failing the record: it reads as
“nothing granted”, which is the safe direction.
It lives beside operator_record rather than beside any of its
callers because a server polling for its own standing, a third-party
verifier checking somebody else’s and the command writing one all
have to agree on the record the same way; two copies of this would
be two definitions of what a claim is.
Sourcepub fn to_json(&self) -> Value
pub fn to_json(&self) -> Value
Renders the claim as the record body bot.did.operator holds —
the inverse of OperatorClaim::from_json, field for field, through
operator_record, so every writer and the one reader agree by
construction.
Rfc3339 refuses only a year outside 0000..=9999, which no
timestamp read by from_json or taken from a clock can carry; the
epoch stands in rather than failing a write over an impossible date.
Trait Implementations§
Source§impl Clone for OperatorClaim
impl Clone for OperatorClaim
Source§fn clone(&self) -> OperatorClaim
fn clone(&self) -> OperatorClaim
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for OperatorClaim
impl Debug for OperatorClaim
Source§impl PartialEq for OperatorClaim
impl PartialEq for OperatorClaim
Source§fn eq(&self, other: &OperatorClaim) -> bool
fn eq(&self, other: &OperatorClaim) -> bool
self and other values to be equal, and is used by ==.impl Eq for OperatorClaim
impl StructuralPartialEq for OperatorClaim
Auto Trait Implementations§
impl Freeze for OperatorClaim
impl RefUnwindSafe for OperatorClaim
impl Send for OperatorClaim
impl Sync for OperatorClaim
impl Unpin for OperatorClaim
impl UnsafeUnpin for OperatorClaim
impl UnwindSafe for OperatorClaim
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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
§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.