pub struct Proven<T> { /* private fields */ }
Available on crate feature
dnssec
only.Expand description
A wrapper type to ensure that the state of a DNSSEC proof is evaluated before use
Implementations§
source§impl<T> Proven<T>
impl<T> Proven<T>
sourcepub fn require_as_ref<I: Into<ProofFlags>>(&self, flags: I) -> Result<&T, Proof>
pub fn require_as_ref<I: Into<ProofFlags>>(&self, flags: I) -> Result<&T, Proof>
Attempts to borrow the value only if it matches flags, returning the associated proof on failure
use hickory_proto::rr::dnssec::{Proof, Proven};
let proven = Proven::new(Proof::Bogus, 42u32);
assert_eq!(*proven.require_as_ref(Proof::Bogus).unwrap(), 42_u32);
assert_eq!(*proven.require_as_ref(Proof::Bogus | Proof::Indeterminate).unwrap(), 42_u32);
assert_eq!(proven.require_as_ref(Proof::Secure | Proof::Insecure).unwrap_err(), Proof::Bogus);
sourcepub fn require<I: Into<ProofFlags>>(self, flags: I) -> Result<T, Self>
pub fn require<I: Into<ProofFlags>>(self, flags: I) -> Result<T, Self>
Attempts to take the value only if it matches flags, returning the associated proof on failure
use hickory_proto::rr::dnssec::{Proof, Proven};
let proven = Proven::new(Proof::Bogus, 42u32);
assert_eq!(proven.clone().require(Proof::Bogus).unwrap(), 42_u32);
assert_eq!(proven.clone().require(Proof::Bogus | Proof::Indeterminate).unwrap(), 42_u32);
assert!(proven.require(Proof::Secure | Proof::Insecure).is_err());
sourcepub fn map<U, F>(self, f: F) -> Proven<U>where
F: FnOnce(T) -> U,
pub fn map<U, F>(self, f: F) -> Proven<U>where
F: FnOnce(T) -> U,
Map the value with the associated function, carrying forward the proof
sourcepub fn into_parts(self) -> (Proof, T)
pub fn into_parts(self) -> (Proof, T)
Unwraps the Proven type into it’s parts
Trait Implementations§
impl<T: Eq> Eq for Proven<T>
impl<T> StructuralPartialEq for Proven<T>
Auto Trait Implementations§
impl<T> Freeze for Proven<T>where
T: Freeze,
impl<T> RefUnwindSafe for Proven<T>where
T: RefUnwindSafe,
impl<T> Send for Proven<T>where
T: Send,
impl<T> Sync for Proven<T>where
T: Sync,
impl<T> Unpin for Proven<T>where
T: Unpin,
impl<T> UnwindSafe for Proven<T>where
T: UnwindSafe,
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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.