Expand description
Provides Candid type conversion and serialization.
CandidTypetrait converts a Rust type to Candid typetypes::Type. The implementation for user-defined data types can be derived fromcandid_derivecrate.Serializertrait serializes a Rust value to Candid binary format. We do not use Serde’sSerializetrait because Candid requires serializing types along with the values. This is difficult to achieve inSerialize, especially for enum types.
Modules§
- arc
- This module provides functions to serialize and deserialize types
under
std::sync::Arcshared 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::Rcshared reference type. - reference
- Data structure for Candid value Func and Service
Note that
FuncandServiceshould not be used directly. We need to define a newtype forFuncorService, and manuallyimpl CandidTypefor the newtype, in order to specify the correct reference type. We have two macrosdefine_function!anddefine_service!to help defining the newtype. - reserved
- Data structure for Candid type Reserved and Empty.
- result
- subtype
- type_
env - value