pub struct PossiblyAuthorisedEntry<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT> {
pub entry: Entry<MCL, MCC, MPL, N, S, PD>,
pub authorisation_token: AT,
}Expand description
An entry, together with an authorisation token that may or may not authorise the entry.
use willow_data_model::prelude::*;
use willow_data_model::test_parameters::*;
let entry = Entry::builder()
.namespace_id(Family)
.subspace_id(Alfie)
.path(Path::<4, 4, 4>::new())
.timestamp(12345)
.payload_digest(Spades)
.payload_length(2)
.build().unwrap();
let pae = PossiblyAuthorisedEntry {
entry: entry.clone(),
authorisation_token: TestSubspaceSignature::new_for_entry(&entry, &AlfieSecret).unwrap(),
};
assert!(pae.into_authorised_entry().is_ok());Fields§
§entry: Entry<MCL, MCC, MPL, N, S, PD>The entry.
The authorisation token, which may or may not authorise the entry.
Implementations§
Source§impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT> PossiblyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>
impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT> PossiblyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>
Checks whether self.authorisation_token authorise self.entry. If so, converts self into an AuthorisedEntry, otherwise returns Err(self).
use willow_data_model::prelude::*;
use willow_data_model::test_parameters::*;
let entry = Entry::builder()
.namespace_id(Family)
.subspace_id(Alfie)
.path(Path::<4, 4, 4>::new())
.timestamp(12345)
.payload_digest(Spades)
.payload_length(2)
.build().unwrap();
let pae1 = PossiblyAuthorisedEntry {
entry: entry.clone(),
authorisation_token: TestSubspaceSignature::new_for_entry(&entry, &AlfieSecret).unwrap(),
};
assert!(pae1.into_authorised_entry().is_ok());
let pae2 = PossiblyAuthorisedEntry {
entry: entry.clone(),
authorisation_token: BettySignature,
};
assert!(pae2.into_authorised_entry().is_err());Converts self into an AuthorisedEntry, without checking if self.authorisation_token authorise self.entry.
use willow_data_model::prelude::*;
use willow_data_model::test_parameters::*;
let entry = Entry::builder()
.namespace_id(Family)
.subspace_id(Alfie)
.path(Path::<4, 4, 4>::new())
.timestamp(12345)
.payload_digest(Spades)
.payload_length(2)
.build().unwrap();
let pae = PossiblyAuthorisedEntry {
entry: entry.clone(),
authorisation_token: TestSubspaceSignature::new_for_entry(&entry, &AlfieSecret).unwrap(),
};
let authed = unsafe { pae.into_authorised_entry_unchecked() };
assert_eq!(authed.as_entry(), &entry);
assert_eq!(authed.as_authorisation_token(), &AlfieSignature);§Safety
Undefined behaviour may occur if self.authorisation_token.does_authorise(&self.entry) is false. If it returns true, this method is safe to call.
Trait Implementations§
Source§impl<'arbitrary, const MCL: usize, const MCC: usize, const MPL: usize, N: Arbitrary<'arbitrary>, S: Arbitrary<'arbitrary>, PD: Arbitrary<'arbitrary>, AT: Arbitrary<'arbitrary>> Arbitrary<'arbitrary> for PossiblyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>
impl<'arbitrary, const MCL: usize, const MCC: usize, const MPL: usize, N: Arbitrary<'arbitrary>, S: Arbitrary<'arbitrary>, PD: Arbitrary<'arbitrary>, AT: Arbitrary<'arbitrary>> Arbitrary<'arbitrary> for PossiblyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>
Source§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
Generate an arbitrary value of
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
Generate an arbitrary value of
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Get a size hint for how many bytes out of an
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Get a size hint for how many bytes out of an
Unstructured this type
needs to construct itself. Read moreSource§impl<const MCL: usize, const MCC: usize, const MPL: usize, N: Clone, S: Clone, PD: Clone, AT: Clone> Clone for PossiblyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>
impl<const MCL: usize, const MCC: usize, const MPL: usize, N: Clone, S: Clone, PD: Clone, AT: Clone> Clone for PossiblyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>
Source§fn clone(&self) -> PossiblyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>
fn clone(&self) -> PossiblyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT> Coordinatelike<MCL, MCC, MPL, S> for PossiblyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>
impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT> Coordinatelike<MCL, MCC, MPL, S> for PossiblyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>
Source§fn wdm_timestamp(&self) -> Timestamp
fn wdm_timestamp(&self) -> Timestamp
Returns the timestamp of
self.Source§impl<const MCL: usize, const MCC: usize, const MPL: usize, N: Debug, S: Debug, PD: Debug, AT: Debug> Debug for PossiblyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>
impl<const MCL: usize, const MCC: usize, const MPL: usize, N: Debug, S: Debug, PD: Debug, AT: Debug> Debug for PossiblyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>
Source§impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT> Entrylike<MCL, MCC, MPL, N, S, PD> for PossiblyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>
impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT> Entrylike<MCL, MCC, MPL, N, S, PD> for PossiblyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>
Source§fn wdm_payload_length(&self) -> u64
fn wdm_payload_length(&self) -> u64
Returns the payload_length of
self.Source§fn wdm_payload_digest(&self) -> &PD
fn wdm_payload_digest(&self) -> &PD
Returns the payload_digest of
self.Source§impl<const MCL: usize, const MCC: usize, const MPL: usize, N: Hash, S: Hash, PD: Hash, AT: Hash> Hash for PossiblyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>
impl<const MCL: usize, const MCC: usize, const MPL: usize, N: Hash, S: Hash, PD: Hash, AT: Hash> Hash for PossiblyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>
Source§impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT> Keylike<MCL, MCC, MPL, S> for PossiblyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>
impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT> Keylike<MCL, MCC, MPL, S> for PossiblyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>
Source§fn wdm_subspace_id(&self) -> &S
fn wdm_subspace_id(&self) -> &S
Returns the subspace_id of
self.Source§impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT> Namespaced<N> for PossiblyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>
impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT> Namespaced<N> for PossiblyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>
Source§fn wdm_namespace_id(&self) -> &N
fn wdm_namespace_id(&self) -> &N
Returns the namespace id of
self.Source§impl<const MCL: usize, const MCC: usize, const MPL: usize, N: Ord, S: Ord, PD: Ord, AT: Ord> Ord for PossiblyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>
impl<const MCL: usize, const MCC: usize, const MPL: usize, N: Ord, S: Ord, PD: Ord, AT: Ord> Ord for PossiblyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>
Source§fn cmp(
&self,
other: &PossiblyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>,
) -> Ordering
fn cmp( &self, other: &PossiblyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>, ) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<const MCL: usize, const MCC: usize, const MPL: usize, N: PartialEq, S: PartialEq, PD: PartialEq, AT: PartialEq> PartialEq for PossiblyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>
impl<const MCL: usize, const MCC: usize, const MPL: usize, N: PartialEq, S: PartialEq, PD: PartialEq, AT: PartialEq> PartialEq for PossiblyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>
Source§fn eq(
&self,
other: &PossiblyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>,
) -> bool
fn eq( &self, other: &PossiblyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>, ) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl<const MCL: usize, const MCC: usize, const MPL: usize, N: PartialOrd, S: PartialOrd, PD: PartialOrd, AT: PartialOrd> PartialOrd for PossiblyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>
impl<const MCL: usize, const MCC: usize, const MPL: usize, N: PartialOrd, S: PartialOrd, PD: PartialOrd, AT: PartialOrd> PartialOrd for PossiblyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>
impl<const MCL: usize, const MCC: usize, const MPL: usize, N: Eq, S: Eq, PD: Eq, AT: Eq> Eq for PossiblyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>
impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT> StructuralPartialEq for PossiblyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>
Auto Trait Implementations§
impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT> !Freeze for PossiblyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>
impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT> RefUnwindSafe for PossiblyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>
impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT> Send for PossiblyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>
impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT> Sync for PossiblyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>
impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT> Unpin for PossiblyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>
impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT> UnwindSafe for PossiblyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>
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,
Source§impl<const MCL: usize, const MCC: usize, const MPL: usize, S, T> CoordinatelikeExt<MCL, MCC, MPL, S> for Twhere
T: Coordinatelike<MCL, MCC, MPL, S>,
impl<const MCL: usize, const MCC: usize, const MPL: usize, S, T> CoordinatelikeExt<MCL, MCC, MPL, S> for Twhere
T: Coordinatelike<MCL, MCC, MPL, S>,
Source§fn wdm_coordinate_eq<OtherCoordinate>(&self, other: &OtherCoordinate) -> boolwhere
OtherCoordinate: Coordinatelike<MCL, MCC, MPL, S>,
S: PartialEq,
fn wdm_coordinate_eq<OtherCoordinate>(&self, other: &OtherCoordinate) -> boolwhere
OtherCoordinate: Coordinatelike<MCL, MCC, MPL, S>,
S: PartialEq,
Returns whether
self and other describe equal coordinates, i.e., whether their subspace ids, paths, and timestamps are all equal. Read moreSource§fn wdm_coordinate_ne<OtherCoordinate>(&self, other: &OtherCoordinate) -> boolwhere
OtherCoordinate: Coordinatelike<MCL, MCC, MPL, S>,
S: PartialEq,
fn wdm_coordinate_ne<OtherCoordinate>(&self, other: &OtherCoordinate) -> boolwhere
OtherCoordinate: Coordinatelike<MCL, MCC, MPL, S>,
S: PartialEq,
Returns whether
self and other describe non-equal coordinates, i.e., whether their subspace ids, paths, and timestamps are not all equal. Read moreSource§impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, E> EntrylikeExt<MCL, MCC, MPL, N, S, PD> for Ewhere
E: Entrylike<MCL, MCC, MPL, N, S, PD>,
impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, E> EntrylikeExt<MCL, MCC, MPL, N, S, PD> for Ewhere
E: Entrylike<MCL, MCC, MPL, N, S, PD>,
Source§fn wdm_entry_eq<OtherEntry>(&self, other: &OtherEntry) -> bool
fn wdm_entry_eq<OtherEntry>(&self, other: &OtherEntry) -> bool
Source§fn wdm_entry_ne<OtherEntry>(&self, other: &OtherEntry) -> bool
fn wdm_entry_ne<OtherEntry>(&self, other: &OtherEntry) -> bool
Source§fn wdm_cmp_recency<OtherEntry>(&self, other: &OtherEntry) -> Ordering
fn wdm_cmp_recency<OtherEntry>(&self, other: &OtherEntry) -> Ordering
Compares
self to another entry by timestamp, payload_digest (in case of a tie), and payload_length third (in case of yet another tie). See also EntrylikeExt::wdm_is_newer_than and EntrylikeExt::wdm_is_older_than. Read moreSource§fn wdm_is_newer_than<OtherEntry>(&self, other: &OtherEntry) -> bool
fn wdm_is_newer_than<OtherEntry>(&self, other: &OtherEntry) -> bool
Returns whether this entry is strictly newer than another entry. See also
EntrylikeExt::wdm_cmp_recency and EntrylikeExt::wdm_is_older_than. Read moreSource§fn wdm_is_older_than<OtherEntry>(&self, other: &OtherEntry) -> bool
fn wdm_is_older_than<OtherEntry>(&self, other: &OtherEntry) -> bool
Returns whether this entry is strictly older than another entry. See also
EntrylikeExt::wdm_cmp_recency and EntrylikeExt::wdm_is_newer_than. Read moreSource§fn wdm_prunes<OtherEntry>(&self, other: &OtherEntry) -> bool
fn wdm_prunes<OtherEntry>(&self, other: &OtherEntry) -> bool
Returns whether this entry would prefix prune another entry. Read more
Source§fn wdm_is_pruned_by<OtherEntry>(&self, other: &OtherEntry) -> bool
fn wdm_is_pruned_by<OtherEntry>(&self, other: &OtherEntry) -> bool
Returns whether this entry would be prefix pruned by another entry. Read more
Source§async fn wdm_encode_entry<C>(&self, consumer: &mut C) -> Result<(), C::Error>
async fn wdm_encode_entry<C>(&self, consumer: &mut C) -> Result<(), C::Error>
Encodes
self according to the encode_entry encoding function.Source§fn wdm_length_of_entry_encoding(&self) -> usize
fn wdm_length_of_entry_encoding(&self) -> usize
Computes the length of the encoding of
self according to the encode_entry encoding function.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 moreSource§impl<const MCL: usize, const MCC: usize, const MPL: usize, S, T> KeylikeExt<MCL, MCC, MPL, S> for Twhere
T: Keylike<MCL, MCC, MPL, S>,
impl<const MCL: usize, const MCC: usize, const MPL: usize, S, T> KeylikeExt<MCL, MCC, MPL, S> for Twhere
T: Keylike<MCL, MCC, MPL, S>,
Source§fn wdm_key_eq<OtherKey>(&self, other: &OtherKey) -> bool
fn wdm_key_eq<OtherKey>(&self, other: &OtherKey) -> bool
Returns whether
self and other describe equal keys, i.e., whether their subspace ids and paths are both equal. Read moreSource§fn wdm_key_ne<OtherKey>(&self, other: &OtherKey) -> bool
fn wdm_key_ne<OtherKey>(&self, other: &OtherKey) -> bool
Returns whether
self and other describe non-equal keys, i.e., whether their subspace ids and paths are not both equal. Read more