Skip to main content

Contract

Struct Contract 

Source
pub struct Contract<Request, Response> {
    pub name: &'static str,
    pub mode: &'static str,
    pub id: u64,
    pub request: Limits,
    pub response: Limits,
    /* private fields */
}
Expand description

A handler’s types and explicit frame settings, without a registry or transport.

Prefer the attribute’s contract = NAME output to a separately maintained declaration. Native schemas do not prove target-specific type-layout parity; the consumer still owns final artifact admission.

Fields§

§name: &'static str

IC method name.

§mode: &'static str

IC mode: query, composite_query, or update.

§id: u64

Native frame method identity.

§request: Limits

Request limits, including the 11-byte frame header.

§response: Limits

Response limits, including the 11-byte frame header.

Implementations§

Source§

impl<Request, Response> Contract<Request, Response>

Source

pub fn admit_request(&self)

Check frame size, identity and direction before copying the full ingress. Run as a Platform guard; payload validation still occurs during decoding.

Auto Trait Implementations§

§

impl<Request, Response> Freeze for Contract<Request, Response>
where PhantomData<fn(Request) -> Response>: Freeze,

§

impl<Request, Response> RefUnwindSafe for Contract<Request, Response>
where PhantomData<fn(Request) -> Response>: RefUnwindSafe,

§

impl<Request, Response> Send for Contract<Request, Response>
where PhantomData<fn(Request) -> Response>: Send,

§

impl<Request, Response> Sync for Contract<Request, Response>
where PhantomData<fn(Request) -> Response>: Sync,

§

impl<Request, Response> Unpin for Contract<Request, Response>
where PhantomData<fn(Request) -> Response>: Unpin,

§

impl<Request, Response> UnsafeUnpin for Contract<Request, Response>
where PhantomData<fn(Request) -> Response>: UnsafeUnpin,

§

impl<Request, Response> UnwindSafe for Contract<Request, Response>
where PhantomData<fn(Request) -> Response>: UnwindSafe,

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> 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, 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.