Module candid::types

source ·
Expand description

Provides Candid type conversion and serialization.

  • CandidType trait converts a Rust type to Candid type types::Type. The implementation for user-defined data types can be derived from candid_derive crate.
  • Serializer trait serializes a Rust value to Candid binary format. We do not use Serde’s Serialize trait because Candid requires serializing types along with the values. This is difficult to achieve in Serialize, especially for enum types.

Re-exports§

Modules§

  • This module provides functions to serialize and deserialize types under std::sync::Arc shared reference type.
  • Data structure for Candid type Int, Nat, supporting big integer with LEB128 encoding.
  • This module provides functions to serialize and deserialize types under std::rc::Rc shared reference type.
  • Data structure for Candid value Func and Service Note that Func and Service should not be used directly. We need to define a newtype for Func or Service, and manually impl CandidType for the newtype, in order to specify the correct reference type. We have two macros define_function! and define_service! to help defining the newtype.
  • Data structure for Candid type Reserved and Empty.
  • valuevalue

Traits§