pub struct StoredDelegation {
pub data: DelegationRecord,
pub status: DelegationStatus,
}Expand description
A delegation as stored in the database (status-agnostic).
When loading from the database, we don’t know the state at compile time.
Use the into_* methods to validate and convert to a typed delegation.
Fields§
§data: DelegationRecord§status: DelegationStatusImplementations§
Source§impl StoredDelegation
impl StoredDelegation
Sourcepub fn into_typed(self) -> LoadedDelegation
pub fn into_typed(self) -> LoadedDelegation
Convert to a typed delegation based on the stored status.
Sourcepub fn into_pending(self) -> Result<Delegation<Pending>, DelegationStateError>
pub fn into_pending(self) -> Result<Delegation<Pending>, DelegationStateError>
Try to convert to a pending delegation.
Sourcepub fn into_accepted(
self,
) -> Result<Delegation<DelegationAccepted>, DelegationStateError>
pub fn into_accepted( self, ) -> Result<Delegation<DelegationAccepted>, DelegationStateError>
Try to convert to an accepted delegation.
Sourcepub fn into_in_progress(
self,
) -> Result<Delegation<InProgress>, DelegationStateError>
pub fn into_in_progress( self, ) -> Result<Delegation<InProgress>, DelegationStateError>
Try to convert to an in-progress delegation.
Sourcepub fn data(&self) -> &DelegationRecord
pub fn data(&self) -> &DelegationRecord
Get the underlying data without state validation.
Sourcepub fn status(&self) -> DelegationStatus
pub fn status(&self) -> DelegationStatus
Get the current status.
Trait Implementations§
Source§impl Clone for StoredDelegation
impl Clone for StoredDelegation
Source§fn clone(&self) -> StoredDelegation
fn clone(&self) -> StoredDelegation
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 Debug for StoredDelegation
impl Debug for StoredDelegation
Source§impl<'de> Deserialize<'de> for StoredDelegation
impl<'de> Deserialize<'de> for StoredDelegation
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
Source§impl PartialEq for StoredDelegation
impl PartialEq for StoredDelegation
Source§impl Serialize for StoredDelegation
impl Serialize for StoredDelegation
impl StructuralPartialEq for StoredDelegation
Auto Trait Implementations§
impl Freeze for StoredDelegation
impl RefUnwindSafe for StoredDelegation
impl Send for StoredDelegation
impl Sync for StoredDelegation
impl Unpin for StoredDelegation
impl UnwindSafe for StoredDelegation
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