pub struct PolicyRecord {
pub name: Option<String>,
pub description: Option<String>,
pub actions: Vec<Action>,
pub document: Document,
pub lookups: Vec<Lookup>,
pub created_at: OffsetDateTime,
}Expand description
One bot.did.policy record.
Fields§
§name: Option<String>What a refusal calls this policy. The record key stands in when
absent — see PolicyRecord::display_name.
description: Option<String>The operator’s own note, never shown to an agent.
actions: Vec<Action>The actions this policy is consulted on.
document: DocumentThe policy document, typed by the engine that reads it.
lookups: Vec<Lookup>The records in other repositories this policy’s statements read, each under the name a statement calls it by.
created_at: OffsetDateTimeWhen the operator wrote the record.
Implementations§
Source§impl PolicyRecord
impl PolicyRecord
Sourcepub fn from_json(value: &Value) -> Result<Self, InvalidRecord>
pub fn from_json(value: &Value) -> Result<Self, InvalidRecord>
Parses a bot.did.policy record’s value object.
Sourcepub fn to_json(&self) -> Value
pub fn to_json(&self) -> Value
The record body, field for field what Self::from_json reads.
Sourcepub fn display_name<'a>(&'a self, key: &'a str) -> &'a str
pub fn display_name<'a>(&'a self, key: &'a str) -> &'a str
What a refusal calls this policy: its name, or key — the record
key it was written at — when it has none.
Trait Implementations§
Source§impl Clone for PolicyRecord
impl Clone for PolicyRecord
Source§fn clone(&self) -> PolicyRecord
fn clone(&self) -> PolicyRecord
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 PolicyRecord
impl Debug for PolicyRecord
Source§impl PartialEq for PolicyRecord
impl PartialEq for PolicyRecord
Source§fn eq(&self, other: &PolicyRecord) -> bool
fn eq(&self, other: &PolicyRecord) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for PolicyRecord
impl StructuralPartialEq for PolicyRecord
Auto Trait Implementations§
impl Freeze for PolicyRecord
impl RefUnwindSafe for PolicyRecord
impl Send for PolicyRecord
impl Sync for PolicyRecord
impl Unpin for PolicyRecord
impl UnsafeUnpin for PolicyRecord
impl UnwindSafe for PolicyRecord
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
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
Checks if this value is equivalent to the given key. Read more
§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.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more