use candid::{CandidType, Decode, Deserialize, Encode};
fn main() {
#[derive(CandidType, Deserialize)]
struct Wrapper(Vec<usize>);
let w = Wrapper(vec![1]);
let b = candid::Encode!(&w).expect("failed to encode");
candid::Decode!(&b[..], Wrapper).expect("failed to decode");
}
fails with:
thread 'X' panicked at 'failed to decode:
Message: "Type mismatch. Type on the wire: Vec; Provided type: Nat64"
States:
Trailing type: [I(-8)]
Trailing value: [01, 01, 00, 00, 00, 00, 00, 00, 00]
Type table: [[I(-20), U(1), U(0), I(1)], [I(-19), I(-8)]]
Remaining value types: []
Minimal repro:
fails with: