pub trait SerDeShelleyFileFormat: Serialize + DeserializeOwned {
const TYPE: &'static str;
const DESCRIPTION: &'static str;
// Provided methods
fn from_file<P: AsRef<Path>>(path: P) -> Result<Self, CodecParseError> { ... }
fn to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), CodecParseError> { ... }
fn to_cbor_bytes(&self) -> Result<Vec<u8>, CodecParseError> { ... }
fn to_cbor_hex(&self) -> Result<String, CodecParseError> { ... }
fn from_cbor_bytes(bytes: &[u8]) -> Result<Self, CodecParseError> { ... }
fn from_cbor_hex(hex: &str) -> Result<Self, CodecParseError> { ... }
}
Expand description
Trait that allows any structure that implements Serialize and DeserializeOwned to be serialized and deserialized following the Shelly json format.
Required Associated Constants§
Sourceconst DESCRIPTION: &'static str
const DESCRIPTION: &'static str
The description of the Cardano key
Provided Methods§
Sourcefn from_file<P: AsRef<Path>>(path: P) -> Result<Self, CodecParseError>
fn from_file<P: AsRef<Path>>(path: P) -> Result<Self, CodecParseError>
Deserialize a type T: Serialize + DeserializeOwned
from file following Cardano
Shelley file format.
Sourcefn to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), CodecParseError>
fn to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), CodecParseError>
Serialize a type T: Serialize + DeserializeOwned
to file following Cardano
Shelley file format.
Sourcefn to_cbor_bytes(&self) -> Result<Vec<u8>, CodecParseError>
fn to_cbor_bytes(&self) -> Result<Vec<u8>, CodecParseError>
Serialize the structure to a CBOR bytes representation.
Sourcefn to_cbor_hex(&self) -> Result<String, CodecParseError>
fn to_cbor_hex(&self) -> Result<String, CodecParseError>
Serialize the structure to a CBOR hex representation.
Sourcefn from_cbor_bytes(bytes: &[u8]) -> Result<Self, CodecParseError>
fn from_cbor_bytes(bytes: &[u8]) -> Result<Self, CodecParseError>
Deserialize a type T: Serialize + DeserializeOwned
from CBOR bytes representation.
Sourcefn from_cbor_hex(hex: &str) -> Result<Self, CodecParseError>
fn from_cbor_hex(hex: &str) -> Result<Self, CodecParseError>
Deserialize a type T: Serialize + DeserializeOwned
from CBOR hex representation.
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.