pub async fn mutate_registry(
    mutations: Vec<RegistryMutation>,
    preconditions: Vec<Precondition>,
) -> Result<u64, String> {
    let mutation_bytes = serialize_atomic_mutate_request(mutations, preconditions);
    let response_bytes = call(REGISTRY_CANISTER_ID, "atomic_mutate", bytes, mutation_bytes)
        .await
        .map_err(|e| {
            format!(
                "The call to the registry's 'atomic_mutate' method failed due to: {}",
                e.1
            )
        })?;
    let response = RegistryAtomicMutateResponse::decode(response_bytes.as_slice())
        .map_err(|e| format!("The registry's response to 'atomic_mutate' could not be decoded as a RegistryAtomicMutateResponse due to: {} ", e))?;
    match response.errors.len() {
        0 => Ok(response.version),
        _ => Err(format!(
            "The call to the registry's 'atomic_mutate' method returned the following errors: {}",
            response
                .errors
                .into_iter()
                .map(Error::from)
                .map(|e| format!("{}", e))
                .collect::<Vec::<String>>()
                .join(", ")
        )),
    }
}
/// Tries to mutate the registry. If it succeeds, returns the version at which
/// that mutation happened.
Tries to mutate the registry. If it succeeds, returns the version at which
that mutation happened.
Tries to mutate the registry . If it succeeds returns the version at which that mutation happened .
pub async fn mutate_registry(
    mutations: Vec<RegistryMutation>,
    preconditions: Vec<Precondition>,
) -> Result<u64, String> {
    let mutation_bytes = serialize_atomic_mutate_request(mutations, preconditions);
    let response_bytes = call(REGISTRY_CANISTER_ID, "atomic_mutate", bytes, mutation_bytes)
        .await
        .map_err(|e| {
            format!(
                "The call to the registry's 'atomic_mutate' method failed due to: {}",
                e.1
            )
        })?;
    let response = RegistryAtomicMutateResponse::decode(response_bytes.as_slice())
        .map_err(|e| format!("The registry's response to 'atomic_mutate' could not be decoded as a RegistryAtomicMutateResponse due to: {} ", e))?;
    match response.errors.len() {
        0 => Ok(response.version),
        _ => Err(format!(
            "The call to the registry's 'atomic_mutate' method returned the following errors: {}",
            response
                .errors
                .into_iter()
                .map(Error::from)
                .map(|e| format!("{}", e))
                .collect::<Vec::<String>>()
                .join(", ")
        )),
    }
}
pub async fn mutate_registry ( mutations : Vec < RegistryMutation > , preconditions : Vec < Precondition > , ) -> Result < u64 , String > { let mutation_bytes = serialize_atomic_mutate_request ( mutations , preconditions ) ; let response_bytes = call ( REGISTRY_CANISTER_ID , " " , bytes , mutation_bytes ) . await . map_err ( | e | { format ! ( " " e 1 ) } ) ? ; let response = RegistryAtomicMutateResponse :: decode ( response_bytes . as_slice ( ) ) . map_err ( | e | format ! ( " " e ) ) ? ; match response . errors . len ( ) { 0 => Ok ( response . version ) , _ => Err ( format ! ( " " response errors into_iter ( ) map ( Error from ) map ( e format ( " " e ) ) collect Vec String ( ) join ( " " ) ) ) , } }
Tries to mutate the registry.
Tries to mutate the registry .
mutations
Vec<RegistryMutation>
preconditions
Vec<Precondition>
mutations
Vec<RegistryMutation>
preconditions
Vec<Precondition>