opentitanlib::util::file

Trait PemSerilizable

Source
pub trait PemSerilizable: ToWriter + FromReader {
    // Required method
    fn label() -> &'static str;

    // Provided methods
    fn write_pem_file(&self, path: &Path) -> Result<()> { ... }
    fn read_pem_file(path: &Path) -> Result<Self> { ... }
}
Expand description

Trait for data that can be written to and read from PEM files.

Required Methods§

Source

fn label() -> &'static str

The label for the PEM file.

Appears around the base64 encoded data. —–BEGIN MY_LABEL—– … —–END MY_LABEL—–

Provided Methods§

Source

fn write_pem_file(&self, path: &Path) -> Result<()>

Write to PEM file with label from Self::label().

Source

fn read_pem_file(path: &Path) -> Result<Self>

Read in from PEM file, ensuring the label matches Self::label().

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§