pub struct OwnedRecord {
pub id: RecordId,
pub timestamp: Timestamp,
pub actor: String,
pub action: String,
pub target: String,
pub outcome: Outcome,
pub prev_hash: Digest,
pub hash: Digest,
}Available on crate feature
alloc only.Expand description
Owned counterpart to Record. Holds String-backed fields instead
of borrowed &strs, so it can outlive the call that produced it.
Convert to a borrowed Record with OwnedRecord::as_record.
§Example
use audit_trail::{Action, Actor, Digest, Outcome, OwnedRecord, Record, RecordId, Target, Timestamp};
let borrowed = Record::new(
RecordId::GENESIS,
Timestamp::from_nanos(1),
Actor::new("system"),
Action::new("chain.init"),
Target::new("chain:0"),
Outcome::Success,
Digest::ZERO,
Digest::ZERO,
);
let owned = OwnedRecord::from_record(&borrowed);
assert_eq!(owned.as_record(), borrowed);Fields§
§id: RecordIdRecord identifier.
timestamp: TimestampRecord timestamp.
actor: StringActor (who).
action: StringAction (what).
target: StringTarget (where).
outcome: OutcomeOutcome (result).
prev_hash: DigestHash of the preceding record in the chain.
hash: DigestHash of this record.
Implementations§
Source§impl OwnedRecord
impl OwnedRecord
Sourcepub fn from_record(record: &Record<'_>) -> Self
pub fn from_record(record: &Record<'_>) -> Self
Copy the fields of a borrowed Record into a new OwnedRecord.
Trait Implementations§
Source§impl Clone for OwnedRecord
impl Clone for OwnedRecord
Source§fn clone(&self) -> OwnedRecord
fn clone(&self) -> OwnedRecord
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 OwnedRecord
impl Debug for OwnedRecord
Source§impl From<&Record<'_>> for OwnedRecord
impl From<&Record<'_>> for OwnedRecord
Source§impl Hash for OwnedRecord
impl Hash for OwnedRecord
Source§impl PartialEq for OwnedRecord
impl PartialEq for OwnedRecord
Source§fn eq(&self, other: &OwnedRecord) -> bool
fn eq(&self, other: &OwnedRecord) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for OwnedRecord
impl StructuralPartialEq for OwnedRecord
Auto Trait Implementations§
impl Freeze for OwnedRecord
impl RefUnwindSafe for OwnedRecord
impl Send for OwnedRecord
impl Sync for OwnedRecord
impl Unpin for OwnedRecord
impl UnsafeUnpin for OwnedRecord
impl UnwindSafe for OwnedRecord
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