pub struct TransferChain {
pub passport_id: PassportId,
pub original_operator: ResponsibleOperator,
pub transfers: Vec<TransferRecord>,
}Expand description
The complete history of responsibility transfers for a DPP.
Maintained as an append-only log. Once a transfer is completed, it cannot be modified or removed.
Fields§
§passport_id: PassportIdThe passport this chain belongs to.
original_operator: ResponsibleOperatorThe original responsible operator (at first publication).
transfers: Vec<TransferRecord>Ordered list of transfer events (oldest first).
Implementations§
Source§impl TransferChain
impl TransferChain
Sourcepub fn new(
passport_id: PassportId,
original_operator: ResponsibleOperator,
) -> Self
pub fn new( passport_id: PassportId, original_operator: ResponsibleOperator, ) -> Self
Create a new chain with an initial operator and no transfers.
Sourcepub fn current_operator(&self) -> &ResponsibleOperator
pub fn current_operator(&self) -> &ResponsibleOperator
Returns the current responsible operator.
If no completed transfers exist, returns the original operator.
Otherwise, returns the to_operator of the most recent completed transfer.
Sourcepub fn transfer_count(&self) -> usize
pub fn transfer_count(&self) -> usize
Returns the total number of completed transfers.
Sourcepub fn initiate_transfer(
&mut self,
record: TransferRecord,
) -> Result<(), TransferError>
pub fn initiate_transfer( &mut self, record: TransferRecord, ) -> Result<(), TransferError>
Append a new transfer record to the chain.
Validates that:
- The
from_operatormatches the current responsible operator. - No other transfer is currently pending (initiated but not completed/cancelled).
Trait Implementations§
Source§impl Clone for TransferChain
impl Clone for TransferChain
Source§fn clone(&self) -> TransferChain
fn clone(&self) -> TransferChain
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 TransferChain
impl Debug for TransferChain
Source§impl<'de> Deserialize<'de> for TransferChain
impl<'de> Deserialize<'de> for TransferChain
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
Auto Trait Implementations§
impl Freeze for TransferChain
impl RefUnwindSafe for TransferChain
impl Send for TransferChain
impl Sync for TransferChain
impl Unpin for TransferChain
impl UnsafeUnpin for TransferChain
impl UnwindSafe for TransferChain
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