Rust support for asset certification.
Certified assets can also be served from any Rust canister by including this library.
[dependencies]
ic-certified-assets = "0.2.1"
The assets are preserved over upgrades by including the corresponding functions in the init/pre_upgrade/upgrade
hooks which can be mixed with the other state from the canister:
```
struct StableState { my_state: MyState, assets: crate::assets::StableState, }
fn init() { crate::assets::init(); }
fn preupgrade() { let stablestate = STATE.with(|s| StableState { mystate: s.mystate, assets: crate::assets::preupgrade(), }); iccdk::storage::stablesave((stablestate,)).expect("failed to save stable state"); }
fn postupgrade() { let (StableState { assets, mystate },): (StableState,) = iccdk::storage::stablerestore().expect("failed to restore stable state"); crate::assets::postupgrade(assets); STATE.with(|s| { s.mystate = my_state; }; } ```
cd assets
icx-asset --pem ~/.config/dfx/identity/default/identity.pem --replica https://ic0.app sync <canister_id> .