import { Result } from "https://deno.land/x/optionals@v3.0.0/mod.ts";
A Rust-like Result class.
Note: Please use either Ok or Err to construct Results.
Methods
Returns the contained Ok value, consuming the Result. Throws an Error with a given message if contained value is not Ok.
Returns the contained Err value, consuming the Result. Throws an Error with a given message if contained value is not an Err.
Maps a Result<T, E> to Result<U, E> by applying a function to a contained Ok value, leaving an Error value untouched.
Maps a Result<T, E> to Result<T, U> by applying a function to a contained Error value, leaving an Ok value untouched.
Returns contained value for use in matching.
Note: Please only use this to match against in if
or swtich
statments.
Returns the contained Error value, consuming the Result. Throws an Error if contained value is not an Error.