pub struct Expected<T>(/* private fields */);Expand description
Holds onto an editable field, and records whether it was an expected or unexpected field.
This is used as a type-safe wrapper around an editable field to encode expectations around the type of field we are expecting in a credential.
This can only be instantiated via the exposed From implementation so that newly
constructed credentials remain spec-compliant with regards to their fields.
Implementations§
Source§impl<T> Expected<T>where
T: EditableFieldType,
impl<T> Expected<T>where
T: EditableFieldType,
Sourcepub fn field_type(&self) -> FieldType
pub fn field_type(&self) -> FieldType
Returns the real FieldType of this field.
Sourcepub fn as_expected(&self) -> Result<&T, &UnexpectedField>
pub fn as_expected(&self) -> Result<&T, &UnexpectedField>
Tries to return the field type we were expecting.
Sourcepub fn into_expected(self) -> Result<T, UnexpectedField>
pub fn into_expected(self) -> Result<T, UnexpectedField>
Tries to return the field type we were expecting as an owned type.
Trait Implementations§
impl<T: Eq> Eq for Expected<T>
Source§impl<T: PartialEq> PartialEq for Expected<T>
impl<T: PartialEq> PartialEq for Expected<T>
impl<T> StructuralPartialEq for Expected<T>
Auto Trait Implementations§
impl<T> Freeze for Expected<T>where
T: Freeze,
impl<T> RefUnwindSafe for Expected<T>where
T: RefUnwindSafe,
impl<T> Send for Expected<T>where
T: Send,
impl<T> Sync for Expected<T>where
T: Sync,
impl<T> Unpin for Expected<T>where
T: Unpin,
impl<T> UnsafeUnpin for Expected<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Expected<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