Skip to main content

Forms

Struct Forms 

Source
pub struct Forms {
    pub request: FormType,
    pub response: FormType,
    pub summary: Option<FormType>,
    pub error: Option<FormType>,
}
Expand description

An operation’s types as its forms carry them (core §5.1, §5.2).

Fields§

§request: FormType§response: FormType§summary: Option<FormType>

replies = "many"’s declared summary, if any (O6).

§error: Option<FormType>

The declared error type, if any: an app error’s detail is a value of it.

Implementations§

Source§

impl Forms

Source

pub fn of(contract: &Contract, op: &Operation) -> Result<Forms, String>

op’s forms, its types read in contract (FormType::of).

§Errors

A packed type of op whose layout does not resolve.

Source

pub fn error_tag(&self) -> Tag

CH’s tag on an error: the error type’s, 0 when it declares none.

Source

pub fn request(&self, record: &[u8]) -> Vec<u8> ⓘ

A request’s bytes, the caller’s (§5.1): CH · record, its width bit 0 and its tag the request type’s.

Source

pub fn value(&self, mark: Stamp, record: &[u8]) -> Vec<u8> ⓘ

A value reply’s bytes, the owner’s (§5.1): the value form, its tag the response type’s, with the replying instance’s as-of mark.

Source

pub fn summary(&self, mark: Stamp, record: &[u8]) -> Option<Vec<u8>>

A summary reply’s bytes (O6): the value form under the summary type’s tag. None for an operation that declares no summary.

Source

pub fn error( &self, mark: Stamp, code: Code, cause: Option<Cause>, message: Option<&str>, detail: Option<&[u8]>, ) -> Result<Vec<u8>, WriteRefusal>

An error reply’s bytes, the owner’s (§5.2): the error form, its tag the error type’s or 0, with the replying instance’s as-of mark. A message is cut at 255 bytes (§7.5); detail is the bytes of a value of the error type, as that type encodes it.

§Errors

WriteRefusal::Undeclared for a detail on an operation that declares no error type, else §7.5’s writer’s refusal: a cause on a code other than unavailable or none on it (cause), a detail on a code other than app (detail).

Source

pub fn read_request<'a>( &self, payload: &'a [u8], ) -> Result<Request<'a>, RequestRefusal>

A query’s payload read as this operation’s request, as its owner reads it (§5.1, “The request”): §7.5’s parse, then a packed record under CH’s tag. Any other kind’s record is its type’s decoder’s.

§Errors

The first refusal: §7.5’s (RequestRefusal::Form: short, form, sample_kind, request_run), then §7.6’s (RequestRefusal::Record: tag, length, code, extension, pad).

Trait Implementations§

Source§

impl Clone for Forms

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 Debug for Forms

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for Forms

Source§

impl PartialEq for Forms

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Forms

Auto Trait Implementations§

§

impl Forget for Forms

§

impl Freeze for Forms
where *const ArcInner<Layout> is !null: Freeze, PhantomData<ArcInner<Layout>>: Freeze,

§

impl Move for Forms

§

impl RefUnwindSafe for Forms

§

impl Send for Forms
where Arc<Layout>: Send,

§

impl Sync for Forms
where Arc<Layout>: Sync,

§

impl Unpin for Forms
where Arc<Layout>: Unpin,

§

impl UnsafeUnpin for Forms
where *const ArcInner<Layout> is !null: UnsafeUnpin, PhantomData<ArcInner<Layout>>: UnsafeUnpin,

§

impl UnwindSafe for Forms

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> AsNode<T> for T

Source§

fn as_node(&self) -> &T

Source§

impl<T> AsNodeMut<T> for T

Source§

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

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.