Skip to main content

Contract

Struct Contract 

Source
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>

Source

pub fn contract_id(&self) -> &ContractId<T>

The contract id, typed.

Source

pub fn payload(&self) -> &T

The payload.

Source

pub fn into_payload(self) -> T

Take the payload.

Source

pub fn created_at_offset(&self) -> i64

The offset the contract was created at.

Source

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.

Source

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.

Source

pub fn created_effective_at(&self) -> Option<OffsetDateTime>

Ledger effective time of the creation.

Source

pub fn archived_effective_at(&self) -> Option<OffsetDateTime>

Ledger effective time of the archival.

Source

pub fn signatories(&self) -> &[String]

The parties that signed it.

Source

pub fn observers(&self) -> &[String]

The parties that observe it.

Source

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.

Source

pub fn package_name(&self) -> &str

The Daml package name — stable across an upgrade.

Source

pub fn package_version(&self) -> &str

The package version.

Source

pub fn package_id(&self) -> &str

The package id — the exact build, which a version does not pin.

Source§

impl<T: DeserializeOwned> Contract<T>

Source

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§

Source§

impl<T: Clone> Clone for Contract<T>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for Contract<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> Freeze for Contract<T>
where ContractId<T>: Freeze, T: Freeze,

§

impl<T> RefUnwindSafe for Contract<T>

§

impl<T> Send for Contract<T>
where ContractId<T>: Send, T: Send,

§

impl<T> Sync for Contract<T>
where ContractId<T>: Sync, T: Sync,

§

impl<T> Unpin for Contract<T>
where ContractId<T>: Unpin, T: Unpin,

§

impl<T> UnsafeUnpin for Contract<T>

§

impl<T> UnwindSafe for Contract<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more