pub struct RawContract {
pub format: String,
pub format_version: u32,
pub semantics_profile: String,
pub canonicalization_profile: String,
pub identities: ContractIdentities,
pub producer: ProducerInfo,
pub types: Vec<TypeNode>,
pub declarations: Vec<Declaration>,
pub actor: Option<Actor>,
}Expand description
Unvalidated Contract data decoded from an external artifact.
This is the serde entry point for Contract JSON. Contract itself
deliberately does not implement Deserialize: a trait impl has no
argument position for a resource policy, so it could only ever decode under
limits the library chose. Callers decode this DTO and convert through a
policy-taking constructor such as Contract::try_from_raw_with_context,
or use a bounded parse entry point such as
Contract::from_json_with_context, which enforces max_input_bytes
before decoding.
Decoding this DTO is not a trust boundary and carries no allocation bound; gate the byte length yourself, or use the bounded parse APIs.
This type is reserved for artifacts that already carry format markers and
identities: Contract::try_from_raw verifies the supplied identities
against recomputation, and From<&Contract> projects a validated
Contract back onto the wire shape. To author a Contract — where no
trustworthy identity exists yet — use ContractDraft, which carries no
identity fields at all and calculates them on build.
// A validated Contract cannot be produced by serde alone.
let _: candid_core::Contract = serde_json::from_str("{}").unwrap();Fields§
§format: String§format_version: u32§semantics_profile: String§canonicalization_profile: String§identities: ContractIdentities§producer: ProducerInfo§types: Vec<TypeNode>§declarations: Vec<Declaration>§actor: Option<Actor>An actorless Contract omits this property entirely. "actor": null is
not part of the v1 wire format: serialization never emits it, the
identity payload never hashes it, and decoding rejects it.
Trait Implementations§
Source§impl Clone for RawContract
impl Clone for RawContract
Source§fn clone(&self) -> RawContract
fn clone(&self) -> RawContract
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RawContract
impl Debug for RawContract
Source§impl<'de> Deserialize<'de> for RawContract
impl<'de> Deserialize<'de> for RawContract
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for RawContract
Source§impl From<&Contract> for RawContract
impl From<&Contract> for RawContract
Source§impl PartialEq for RawContract
impl PartialEq for RawContract
Source§impl Serialize for RawContract
impl Serialize for RawContract
impl StructuralPartialEq for RawContract
Auto Trait Implementations§
impl Freeze for RawContract
impl RefUnwindSafe for RawContract
impl Send for RawContract
impl Sync for RawContract
impl Unpin for RawContract
impl UnsafeUnpin for RawContract
impl UnwindSafe for RawContract
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.