How to use Result function?

I want examples for the Result function. Can anyone help me?

Rust? What is Result function do you mean?

Using Motoko:

  1. declare Type (snippet):
    type Result<T,E> = Result.Result<T,E>;

2.function (snippet):

public shared query ({caller}) func exportStore() : async Result<[(Id, Instruction)],Text> {
        let isAllowed : Bool = Principal.equal(canisterOwner,caller);
        if (isAllowed) {
        } else {
            #err("Caller isn't allowed to export the store. Caller is : " # Principal.toText(caller));
1 Like