|
1 | | -struct Manifest { |
2 | | - name: String, |
| 1 | +use serde::Deserialize; |
| 2 | + |
| 3 | +/// Represents the manifest describing a single canister, |
| 4 | +/// including its name and how it should be built. |
| 5 | +#[derive(Debug, Deserialize)] |
| 6 | +pub struct CanisterManifest { |
| 7 | + /// Name of the canister described by this manifest. |
| 8 | + pub name: String, |
| 9 | + |
| 10 | + /// Build configuration for producing the canister's WebAssembly. |
| 11 | + pub build: Build, |
| 12 | +} |
| 13 | + |
| 14 | +/// Describes how the canister should be built into WebAssembly, |
| 15 | +/// including the adapter responsible for the build. |
| 16 | +#[derive(Debug, Deserialize)] |
| 17 | +pub struct Build { |
| 18 | + pub adapter: Adapter, |
| 19 | +} |
| 20 | + |
| 21 | +/// Identifies the type of adapter used to build the canister, |
| 22 | +/// e.g. "motoko", "rust", or "custom". |
| 23 | +#[derive(Debug, Deserialize)] |
| 24 | +pub struct Adapter { |
| 25 | + #[serde(rename = "type")] |
| 26 | + pub typ: AdapterType, |
| 27 | +} |
| 28 | + |
| 29 | +/// Known adapter types that can be used to build a canister. |
| 30 | +/// These correspond to the values found in `build.adapter.type` in the YAML. |
| 31 | +#[derive(Debug, Deserialize)] |
| 32 | +#[serde(rename_all = "lowercase")] |
| 33 | +pub enum AdapterType { |
| 34 | + /// A canister written in Rust. |
| 35 | + Rust, |
| 36 | + |
| 37 | + /// A canister written in Motoko. |
| 38 | + Motoko, |
| 39 | + |
| 40 | + /// A canister built using custom instructions, |
| 41 | + /// such as a shell script or other manual build process. |
| 42 | + Custom, |
| 43 | + |
| 44 | + /// An assets canister used to serve front-end applications |
| 45 | + /// or static assets on the Internet Computer. |
| 46 | + Assets, |
3 | 47 | } |
0 commit comments