logo
pub struct Encoder<'l, 'o> { /* private fields */ }
Expand description

Buffered PEM encoder.

Stateful buffered encoder type which encodes an input PEM document according to RFC 7468’s “Strict” grammar.

Implementations

Create a new PEM Encoder with the default options which writes output into the provided buffer.

Uses the default 64-character line wrapping.

Create a new PEM Encoder which wraps at the given line width.

Note that per RFC7468 § 2 encoding PEM with any other wrap width besides 64 is technically non-compliant:

Generators MUST wrap the base64-encoded lines so that each line consists of exactly 64 characters except for the final line, which will encode the remainder of the data (within the 64-character line boundary)

This method is provided with the intended purpose of implementing the OpenSSH private key format, which uses a non-standard wrap width of 70.

Get the PEM type label used for this document.

Encode the provided input data.

This method can be called as many times as needed with any sized input to write data encoded data into the output buffer, so long as there is sufficient space in the buffer to handle the resulting Base64 encoded data.

Borrow the inner Base64Encoder.

Finish encoding PEM, writing the post-encapsulation boundary.

On success, returns the total number of bytes written to the output buffer.

Trait Implementations

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

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

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

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

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

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

Attempts to write multiple buffers into this writer. Read more

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

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.