Skip to main content

decode_one_with_decoding_quota

Function decode_one_with_decoding_quota 

Source
pub fn decode_one_with_decoding_quota<const N: usize, T>(byte_vec: Vec<u8>) -> T
where T: for<'a> Deserialize<'a> + CandidType,
Expand description

Decode a single argument with a decoding_quota specified as a const generic number.

This function is particularly useful as a decoder in ic-cdk macros (version 0.18 and up).

Example:

#[ic_cdk::query(decode_with = "decode_one_with_decoding_quota::<10000,_>")]
fn count(arg: String) -> u32 {
   arg.len() as u32
}