pub struct Contract<T> { /* private fields */ }Expand description
A contract as PQS holds it: the typed payload, plus the ledger facts about it.
Implementations§
Source§impl<T> Contract<T>
impl<T> Contract<T>
Sourcepub fn contract_id(&self) -> &ContractId<T>
pub fn contract_id(&self) -> &ContractId<T>
The contract id, typed.
Sourcepub fn into_payload(self) -> T
pub fn into_payload(self) -> T
Take the payload.
Sourcepub fn created_at_offset(&self) -> i64
pub fn created_at_offset(&self) -> i64
The offset the contract was created at.
Sourcepub fn archived_at_offset(&self) -> Option<i64>
pub fn archived_at_offset(&self) -> Option<i64>
The offset it was archived at, if it has been archived at all.
Being set does not mean the contract was inactive for the read that
returned it. active_at(o) selects contracts whose lifetime covers
o, so a contract that was live then and archived afterwards comes back
with this set — filtering those out would drop exactly the rows the
query asked for. Compare it against the offset that was read at:
was_active_at does that.
Sourcepub fn was_active_at(&self, offset: i64) -> bool
pub fn was_active_at(&self, offset: i64) -> bool
Whether the contract was active at offset.
There is no offset-free answer to “is this active”: it depends on when
you are asking about. A contract read by active_at(o) was active at
o whatever this says about later offsets.
Sourcepub fn created_effective_at(&self) -> Option<OffsetDateTime>
pub fn created_effective_at(&self) -> Option<OffsetDateTime>
Ledger effective time of the creation.
Sourcepub fn archived_effective_at(&self) -> Option<OffsetDateTime>
pub fn archived_effective_at(&self) -> Option<OffsetDateTime>
Ledger effective time of the archival.
Sourcepub fn signatories(&self) -> &[String]
pub fn signatories(&self) -> &[String]
The parties that signed it.
Sourcepub fn witnesses(&self) -> &[String]
pub fn witnesses(&self) -> &[String]
Every party that witnessed it — the column Predicate::witness filters
on, so selecting by it and then not being able to see it made no sense.
Sourcepub fn package_name(&self) -> &str
pub fn package_name(&self) -> &str
The Daml package name — stable across an upgrade.
Sourcepub fn package_version(&self) -> &str
pub fn package_version(&self) -> &str
The package version.
Sourcepub fn package_id(&self) -> &str
pub fn package_id(&self) -> &str
The package id — the exact build, which a version does not pin.
Source§impl<T: DeserializeOwned> Contract<T>
impl<T: DeserializeOwned> Contract<T>
Sourcepub fn from_row(row: &Row) -> Result<Self>
pub fn from_row(row: &Row) -> Result<Self>
Decode one row.
§Errors
Error::UnexpectedResponse if a column is missing or of another type,
Error::Payload if the payload does not match T.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Contract<T>
impl<T> RefUnwindSafe for Contract<T>
impl<T> Send for Contract<T>
impl<T> Sync for Contract<T>
impl<T> Unpin for Contract<T>
impl<T> UnsafeUnpin for Contract<T>
impl<T> UnwindSafe for Contract<T>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request