Skip to main content

candid/types/
principal.rs

1use super::{CandidType, Serializer, Type, TypeInner};
2
3pub use ic_principal::{Principal, PrincipalError};
4
5impl CandidType for Principal {
6    fn _ty() -> Type {
7        TypeInner::Principal.into()
8    }
9    fn idl_serialize<S>(&self, serializer: S) -> Result<(), S::Error>
10    where
11        S: Serializer,
12    {
13        serializer.serialize_principal(self.as_slice())
14    }
15}