Skip to content

Should Writer have a flush method? #9126

Closed
@anasazi

Description

@anasazi

Currently, rt::io::Writer requires a method flush(&mut self) that flushes output. However, this does not make sense for every implementation of Writer. Specifically, libuv has no notion of flush, so none of the current I/O can do it anyway. Some implementations fail! when called (TcpStream, UdpSocket) while others do nothing at all (FileStream).

Rather than unifying the I/O system on the fail! option or the no-op option, I'd like to suggest removing flush from Writer and creating a trait Flushable that extends Writer. We really shouldn't be implementing methods where they don't make sense when we can do otherwise.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-runtimeArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflowsE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions