Skip to content
CryoCryo home
Stdlibfmt

error

import std::fmt::error; · source

FmtError

type enum FmtError {
    Io(IoError);
    Alloc(AllocError);
}

implement enum FmtError {
    is_io(&this) -> boolean;
    is_alloc(&this) -> boolean;
    describe(&this) -> Str;
}

A formatted write can fail two ways, and collapsing them would throw away information a caller might want to branch on — a format that failed because String::push couldn't reallocate is not the same shape of problem as a closed socket. describe forwards to the wrapped error's own describe.

Trait implementations

implement trait From<IoError> for enum FmtError

implement trait From<AllocError> for enum FmtError

implement trait Display for enum FmtError   // std::fmt::display

implement trait Debug for enum FmtError   // std::fmt::display

The two From impls are the lifting conversions sink implementations use, which is what lets ? on an io::Write call inside a FmtWrite impl just work.