Module types

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

Modules§

arc
This module provides functions to serialize and deserialize types under std::sync::Arc shared reference type.
internal
leb128
number
Data structure for Candid type Int, Nat, supporting big integer with LEB128 encoding.
principal
rc
This module provides functions to serialize and deserialize types under std::rc::Rc shared reference type.
reference
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.
reserved
Data structure for Candid type Reserved and Empty.
result
subtype
type_env
value

Structs§

Field
Function
Type
TypeEnv
TypeId

Enums§

FuncMode
Label
TypeInner

Traits§

CandidType
Compound
Serializer

Functions§

get_type

Type Aliases§

SharedLabel