/// Inserts a value into the registry.
Inserts a value into the registry.
Inserts a value into the registry .
pub async fn insert_value<T: Message + Default>(registry: &Canister<'_>, key: &[u8], value: &T) {
    let response_bytes = registry
        .update_(
            "atomic_mutate",
            bytes,
            encode_or_panic(&RegistryAtomicMutateRequest {
                mutations: vec![RegistryMutation {
                    mutation_type: Type::Insert as i32,
                    key: key.to_vec(),
                    value: encode_or_panic(value),
                }],
                preconditions: vec![],
            }),
        )
        .await
        .unwrap();
    let response = RegistryAtomicMutateResponse::decode(response_bytes.as_slice()).unwrap();
    assert_matches!(response,
        RegistryAtomicMutateResponse {
            errors,
            version: _
        } if errors.is_empty()
    );
}
pub async fn insert_value < T : Message + Default > ( registry : & Canister < ' _ > , key : & [ u8 ] , value : & T ) { let response_bytes = registry . update_ ( " " , bytes , encode_or_panic ( & RegistryAtomicMutateRequest { mutations : vec ! [ RegistryMutation { mutation_type Type Insert as i32 key key to_vec ( ) value encode_or_panic ( value ) } ] , preconditions : vec ! [ ] , } ) , ) . await . unwrap ( ) ; let response = RegistryAtomicMutateResponse :: decode ( response_bytes . as_slice ( ) ) . unwrap ( ) ; assert_matches ! ( response RegistryAtomicMutateResponse { errors version } if errors is_empty ( ) ) ; }
Inserts a value into the registry.
Inserts a value into the registry .
registry
&Canister<'_>
key
&[u8]
value
&T