pub struct Grant { /* private fields */ }Expand description
A grant: a reference to an Authority value plus the Derivation that
justifies holding it.
The id-split fix: the grant references its authority by AuthorityId
rather than inlining the Caveats, so the authority value and the grant
are two distinct objects with two distinct CIDs. The same authority reached
by two different derivations is two different grants (correct), and a grant’s
identity is not silently a re-hash of the raw caveats.
Implementations§
Source§impl Grant
impl Grant
Sourcepub fn new(authority: AuthorityId, derivation: Derivation) -> Self
pub fn new(authority: AuthorityId, derivation: Derivation) -> Self
A grant over authority justified by derivation.
The authority this grant confers, by content id.
Sourcepub fn derivation(&self) -> &Derivation
pub fn derivation(&self) -> &Derivation
How this grant was derived.
Trait Implementations§
Source§impl ContentAddressable for Grant
impl ContentAddressable for Grant
Source§fn canonical_form(&self) -> Result<Vec<u8>, ContentError>
fn canonical_form(&self) -> Result<Vec<u8>, ContentError>
Produce the deterministic byte representation of this value. Read more
Source§fn content_id(&self) -> Result<ContentId, ContentError>
fn content_id(&self) -> Result<ContentId, ContentError>
Source§fn verify(&self, expected: &ContentId) -> Result<bool, ContentError>
fn verify(&self, expected: &ContentId) -> Result<bool, ContentError>
Check whether this value’s content id matches an
expected id. Read moreSource§fn ensure_content_id(&self, expected: &ContentId) -> Result<(), ContentError>
fn ensure_content_id(&self, expected: &ContentId) -> Result<(), ContentError>
Verify, returning an error on mismatch instead of
Ok(false). Read moreSource§fn from_canonical_form(bytes: &[u8]) -> Result<Self, ContentError>where
Self: Sized + DeserializeOwned,
fn from_canonical_form(bytes: &[u8]) -> Result<Self, ContentError>where
Self: Sized + DeserializeOwned,
Checked ingress: decode a value from its canonical form, proving the
bytes reproduce it — a checked partial inverse of
canonical_form. Read moreSource§impl<'de> Deserialize<'de> for Grant
impl<'de> Deserialize<'de> for Grant
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 Grant
impl StructuralPartialEq for Grant
Auto Trait Implementations§
impl Freeze for Grant
impl RefUnwindSafe for Grant
impl Send for Grant
impl Sync for Grant
impl Unpin for Grant
impl UnsafeUnpin for Grant
impl UnwindSafe for Grant
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