Struct libflate::Finish [] [src]

pub struct Finish<T, E> { /* fields omitted */ }

Finish is a type that represents a value which may have an error occurred during the computation.

Logically, Finish<T, E> is equivalent to Result<T, (T, E)>.

Methods

impl<T, E> Finish<T, E>
[src]

Makes a new instance.

Examples

use libflate::Finish;

// The result value of a succeeded computation
let succeeded = Finish::new("value", None as Option<()>);
assert_eq!(succeeded.into_result(), Ok("value"));

// The result value of a failed computation
let failed = Finish::new("value", Some("error"));
assert_eq!(failed.into_result(), Err("error"));

Unwraps the instance.

Examples

use libflate::Finish;

let succeeded = Finish::new("value", None as Option<()>);
assert_eq!(succeeded.unwrap(), ("value", None));

let failed = Finish::new("value", Some("error"));
assert_eq!(failed.unwrap(), ("value", Some("error")));

Converts from Finish<T, E> to Result<T, E>.

Examples

use libflate::Finish;

let succeeded = Finish::new("value", None as Option<()>);
assert_eq!(succeeded.into_result(), Ok("value"));

let failed = Finish::new("value", Some("error"));
assert_eq!(failed.into_result(), Err("error"));

Converts from Finish<T, E> to Result<&T, &E>.

Examples

use libflate::Finish;

let succeeded = Finish::new("value", None as Option<()>);
assert_eq!(succeeded.as_result(), Ok(&"value"));

let failed = Finish::new("value", Some("error"));
assert_eq!(failed.as_result(), Err(&"error"));

Trait Implementations

impl<T: Debug, E: Debug> Debug for Finish<T, E>
[src]

Formats the value using the given formatter.

impl<T: Default, E: Default> Default for Finish<T, E>
[src]

Returns the "default value" for a type. Read more

impl<T: Clone, E: Clone> Clone for Finish<T, E>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<T: PartialOrd, E: PartialOrd> PartialOrd for Finish<T, E>
[src]

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl<T: Ord, E: Ord> Ord for Finish<T, E>
[src]

This method returns an Ordering between self and other. Read more

impl<T: PartialEq, E: PartialEq> PartialEq for Finish<T, E>
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<T: Eq, E: Eq> Eq for Finish<T, E>
[src]

impl<T: Hash, E: Hash> Hash for Finish<T, E>
[src]

Feeds this value into the state given, updating the hasher as necessary.

Feeds a slice of this type into the state provided.