Struct specs::common::Errors[][src]

pub struct Errors { /* fields omitted */ }

A resource you can use to store errors that occurred outside of the ECS but were catched inside, therefore should be handled by the user.

Methods

impl Errors
[src]

Creates a new instance of Errors.

Add an error to the error collection.

A convenience method which allows nicer error handling.

Examples

errors.execute::<Error, _>(|| {
    let y = do_something()?;
    println!("{}", y + 5);

    Ok(())
});

So the closure you pass to this method is essentially an environment where you can use ? for error handling.

Checks if the queue contains at least one error.

Removes the first error from the queue.

Important traits for DrainErrors<'a>

Returns a draining iterator, removing elements on each call to Iterator::next.

Important traits for Vec<u8>

Collect all errors into a Vec.

Prints all errors and exits in case there's been an error. Useful for debugging.

Trait Implementations

impl Debug for Errors
[src]

Formats the value using the given formatter. Read more

impl Default for Errors
[src]

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

Auto Trait Implementations

impl Send for Errors

impl Sync for Errors