Struct basic_text::TextDuplexer[][src]

pub struct TextDuplexer<Inner: HalfDuplex + ReadStr + WriteStr> { /* fields omitted */ }
Expand description

A HalfDuplex implementation which translates from an input HalfDuplex implementation producing an arbitrary byte sequence into a valid Basic Text stream.

Implementations

Construct a new instance of TextDuplexer wrapping inner, which can be anything that implements HalfDuplex.

Like new, but writes a U+FEFF (BOM) to the beginning of the output stream for compatibility with consumers that require that to determine the text encoding.

Like new, but enables CRLF output mode, which translates “\n” to “\r\n” for compatibility with consumers that need that.

Note: This is not often needed; even on Windows these days most things are ok with plain ‘\n’ line endings, including Windows Notepad. The main notable things that really need them are IETF RFCs, for example RFC-5198.

Like new, but replaces U+85 (NEL) with U+A instead of U+20.

Like new, but replaces U+2028 (LS) and U+2029 (PS) with U+A instead of U+20.

Construct a new instance of TextDuplexer wrapping inner.

Like from_utf8, but writes a U+FEFF (BOM) to the beginning of the output stream for compatibility with consumers that require that to determine the text encoding.

Like from_utf8, but enables CRLF output mode, which translates “\n” to “\r\n” for compatibility with consumers that need that.

Note: This is not often needed; even on Windows these days most things are ok with plain ‘\n’ line endings, including Windows Notepad. The main notable things that really need them are IETF RFCs, for example RFC-5198.

Like from_utf8, but replaces U+85 (NEL) with U+A instead of U+20.

Like from_utf8, but replaces U+2028 (LS) and U+2029 (PS) with U+A instead of U+20.

Flush and close the underlying stream and return the underlying stream object.

Return the underlying stream object.

Trait Implementations

Borrows the file descriptor. Read more

Extracts the raw file descriptor. Read more

A suggested size, in bytes, for buffering for performance.

Close the resource and abandon any pending buffered contents or errors.

Formats the value using the given formatter. Read more

Pull some bytes from this source into the specified buffer, returning how many bytes were read. Read more

Read all bytes until EOF in this source, placing them into buf. Read more

Read all bytes until EOF in this source, appending them to buf. Read more

Like read, except that it reads into a slice of buffers. Read more

🔬 This is a nightly-only experimental API. (can_vector)

Determines if this Reader has an efficient read_vectored implementation. Read more

🔬 This is a nightly-only experimental API. (read_initializer)

Determines if this Reader can work with buffers of uninitialized memory. Read more

Read the exact number of bytes required to fill buf. Read more

Creates a “by reference” adaptor for this instance of Read. Read more

Transforms this Read instance to an Iterator over its bytes. Read more

Creates an adaptor which will chain this stream with another. Read more

Creates an adaptor which will read at most limit bytes from it. Read more

Like Read::read, but also returns a Status.

Some streams require a buffer of at least a certain size.

Like Read::read_vectored, but also returns a Status.

Like Read::read_exact, but uses read_with_status to avoid performing an extra read at the end. Read more

Like read but produces the result in a str. Be sure to check the size field of the return value to see how many bytes were written. Read more

Like read_exact but produces the result in a str.

Like read_with_status but produces the result in a str. Be sure to check the return value to see how many bytes were written. Read more

Like read_exact but produces the result in a str. Read more

Like read_str but for reading Basic Text content. Note that the resulting data may not be a Basic Text string, as it may be eg. a portion of a stream that starts with a non-starter. Read more

Like read_exact_str but for reading Basic Text content. As with read_text, the resulting string may not be a Basic Text string. Read more

Like read_to_string, but reads into a TextString.

Like read_str_with_status but for reading Basic Text data. Note that the resulting data may not be a Basic Text string, as it may be eg. a portion of a stream that starts with a non-starter. Read more

Like read_exact_str_using_status but for reading Basic Text content. As with read_text, the resulting string may not be a Basic Text string. Read more

Write a buffer into this writer, returning how many bytes were written. Read more

Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more

🔬 This is a nightly-only experimental API. (can_vector)

Determines if this Writer has an efficient write_vectored implementation. Read more

Like write, except that it writes from a slice of buffers. Read more

🔬 This is a nightly-only experimental API. (write_all_vectored)

Attempts to write multiple buffers into this writer. Read more

Attempts to write an entire buffer into this writer. Read more

Writes a formatted string into this writer, returning any error encountered. Read more

Creates a “by reference” adaptor for this instance of Write. Read more

Flush any buffers and declare the end of the stream. Subsequent writes will fail. Read more

Like Write::flush, but has a status parameter describing the future of the stream: Read more

Like Write::write_all, but takes a &str, allowing implementors which require valid UTF-8 to avoid re-validating the data. Read more

Like WriteStr::write_str but writes from a TextSubstr.

Like WriteStr::write_str but writes from a TextStr.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Borrows the reference. Read more

Return a borrowing view of a resource which dereferences to a &Target or &mut Target. Read more

Extracts the grip.

Extracts the raw grip.

Borrows the reference.

Return a borrowing view of a resource which dereferences to a &Target or &mut Target. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.