Ok<T, E> class

Ok is a type that represents success and contains a T type success value.

Inheritance
Available Extensions
Annotations
  • @sealed

Constructors

Ok(T _value)
const

Properties

hashCode int
The hash code for this object.
no setteroverride
isErr bool
Returns true if the result is Err.
no setterinherited
isOk bool
Returns true if the result is Ok.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

and<U>(Result<U, E> res) Result<U, E>
Returns res if the result is Ok, otherwise returns the Err value of this.
inherited
andThen<U>(Result<U, E> op(T value)) Result<U, E>
Calls op if the result is Ok, otherwise returns the Err value of this.
inherited
err() → E?
Converts from Result<T, E> to E?.
inherited
errOpt() Option<E>
Converts from Result<T, E> to Option<E>.
inherited
expect(String msg) → T
Returns the contained Ok value, consuming the this value.
inherited
expectErr(String msg) → E
Returns the contained Err value, consuming the this value.
inherited
iter() Iterable<T>
Returns an iterable over the possibly contained value.
inherited
map<U>(U op(T value)) Result<U, E>
Maps a Result<T, E> to Result<U, E> by applying a function to a contained Ok value, leaving an Err value untouched.
inherited
mapErr<F>(F op(E err)) Result<T, F>
Maps a Result<T, E> to Result<T, F> by applying a function to a contained Err value, leaving an Ok value untouched.
inherited
mapOr<U>(U defaultValue, U f(T value)) → U
Returns the provided default (if Err), or applies a function to the contained value (if Ok),
inherited
mapOrElse<U>(U defaultF(E err), U f(T value)) → U
Maps a Result<T, E> to U by applying fallback function defaultF to a contained Err value, or function f to a contained Ok value.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
ok() → T?
Converts from Result<T, E> to T?.
inherited
okOpt() Option<T>
Converts from Result<T, E> to Option<T>.
inherited
or<F>(Result<T, F> res) Result<T, F>
Returns res if the result is Err, otherwise returns the Ok value of this.
inherited
orElse<F>(Result<T, F> op(E err)) Result<T, F>
Calls op if the result is Err, otherwise returns the Ok value of this.
inherited
toString() String
A string representation of this object.
override
unwrap() → T
Returns the contained Ok value, consuming the this value.
inherited
unwrapErr() → E
Returns the contained Err value, consuming the this value.
inherited
unwrapOr(T defaultValue) → T
Returns the contained Ok value or a provided default.
inherited
unwrapOrElse(T op(E err)) → T
Returns the contained Ok value or computes it from a closure.
inherited

Operators

operator ==(Object other) bool
The equality operator.
override