Crate cstream

Source
Expand description

Utilities for libc::FILE streams ‘c streams’

§Features

  • Owned and borrowed c streams. Mirroring std::os::fd’s API.
  • Rusty wrappers around libc’s stream-oriented functions. libc::fgets becomes gets, etc.
  • An Io wrapper, which implements io traits.

Structs§

BorrowedCStream
A borrowed RawCStream.
BufferedCStreamalloc
An OwnedCStream with a custom buffer.
FError
A capture of the error indicator on a RawCStream through libc::ferror.
Iostd
A wrapper around an AsCStream that implements std::io traits:
OwnedCStream
An owned RawCStream. This libc::fcloses the stream on drop. It is guaranteed that nobody else will close the stream.

Enums§

BufferMode

Traits§

AsCStream
A trait to borrow a stream from an underlying object.
AsRawCStream
A trait to extract the raw stream from an underlying object.
FromRawCStream
A trait to express the ability to construct an object from a raw stream.
IntoRawCStream
A trait to express the ability to consume an object and acquire ownership of its raw stream.

Functions§

clear_errors
Wrapper around libc::clearerr.
eof
Wrapper around libc::feof.
fileno
Wrapper around libc::fileno.
flush
Wrapper around libc::fflush.
getc
Wrapper around libc::fgetc.
gets
Wrapper around libc::fgets.
open
Wrapper around libc::fopen.
putc
Wrapper around libc::fputc.
puts
Wrapper around libc::fputs.
read
Wrapper around libc::fread.
reopen
Wrapper around libc::freopen.
rewind
Wrapper around libc::rewind.
seekstd
Wrapper around libc::fseek.
tell
Wrapper around libc::ftell.
tmpfile
ungetc
Wrapper around libc::ungetc.
write
Wrapper around libc::fwrite.

Type Aliases§

RawCStream
A libc::FILE stream.