linera_sdk::abi

Trait ContractAbi

Source
pub trait ContractAbi {
    type Operation: Serialize + DeserializeOwned + Send + Sync + Debug + 'static;
    type Response: Serialize + DeserializeOwned + Send + Sync + Debug + 'static;

    // Provided methods
    fn deserialize_operation(
        operation: Vec<u8>,
    ) -> Result<Self::Operation, String> { ... }
    fn serialize_operation(
        operation: &Self::Operation,
    ) -> Result<Vec<u8>, String> { ... }
    fn deserialize_response(response: Vec<u8>) -> Result<Self::Response, String> { ... }
    fn serialize_response(response: Self::Response) -> Result<Vec<u8>, String> { ... }
}
Expand description

A trait that includes all the types exported by a Linera application contract.

Required Associated Types§

Source

type Operation: Serialize + DeserializeOwned + Send + Sync + Debug + 'static

The type of operation executed by the application.

Operations are transactions directly added to a block by the creator (and signer) of the block. Users typically use operations to start interacting with an application on their own chain.

Source

type Response: Serialize + DeserializeOwned + Send + Sync + Debug + 'static

The response type of an application call.

Provided Methods§

Source

fn deserialize_operation(operation: Vec<u8>) -> Result<Self::Operation, String>

How the Operation is deserialized

Source

fn serialize_operation(operation: &Self::Operation) -> Result<Vec<u8>, String>

How the Operation is serialized

Source

fn deserialize_response(response: Vec<u8>) -> Result<Self::Response, String>

How the Response is deserialized

Source

fn serialize_response(response: Self::Response) -> Result<Vec<u8>, String>

How the Response is serialized

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§