Skip to content

IoResult bloats return values #12294

Closed
Closed
@mneumann

Description

@mneumann

IoResult adds 3 words to every function that returns it:

pub type IoResult<T> = Result<T, IoError>;

pub struct IoError {
    kind: IoErrorKind,
    desc: &'static str,
    detail: Option<~str>,
}

Wouldn't it be better to retrieve the exact error information out of the underlying reader/writer. I know that this introduces state which has some other problems. My idea is to simply return an Ok(T) or Err in the same way as Go handles this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions