Expand description
Provides Candid type conversion and serialization.
CandidType
trait converts a Rust type to Candid typetypes::Type
. The implementation for user-defined data types can be derived fromcandid_derive
crate.Serializer
trait serializes a Rust value to Candid binary format. We do not use Serde’sSerialize
trait because Candid requires serializing types along with the values. This is difficult to achieve inSerialize
, especially for enum types.
Re-exports§
pub use self::internal::get_type;
pub use self::internal::Field;
pub use self::internal::FuncMode;
pub use self::internal::Function;
pub use self::internal::Label;
pub use self::internal::Type;
pub use self::internal::TypeId;
pub use self::internal::TypeInner;
pub use type_env::TypeEnv;
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
andService
should not be used directly. We need to define a newtype forFunc
orService
, and manuallyimpl CandidType
for the newtype, in order to specify the correct reference type. We have two macrosdefine_function!
anddefine_service!
to help defining the newtype. - Data structure for Candid type Reserved and Empty.