pub trait EncodableKey: Sized {
// Required methods
fn read<R: Read>(reader: &mut R) -> Result<Self, Box<dyn Error>>;
fn write<W: Write>(&self, writer: &mut W) -> Result<String, Box<dyn Error>>;
// Provided methods
fn read_from_file<F: AsRef<Path>>(path: F) -> Result<Self, Box<dyn Error>> { ... }
fn write_to_file<F: AsRef<Path>>(
&self,
outfile: F,
) -> Result<String, Box<dyn Error>> { ... }
}
Expand description
The EncodableKey
trait defines the interface by which cryptographic keys/keypairs are read,
written, and derived from sources.
Required Methods§
fn read<R: Read>(reader: &mut R) -> Result<Self, Box<dyn Error>>
fn write<W: Write>(&self, writer: &mut W) -> Result<String, Box<dyn Error>>
Provided Methods§
fn read_from_file<F: AsRef<Path>>(path: F) -> Result<Self, Box<dyn Error>>
fn write_to_file<F: AsRef<Path>>( &self, outfile: F, ) -> Result<String, Box<dyn Error>>
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.