FileDocument

Trait FileDocument 

Source
pub trait FileDocument
where Self: From<Self::FallbackDocType>,
{ type FallbackDocType: StrictDecode; const DOC_MAGIC: [u8; 4]; const FILE_EXT: &'static str; // Provided methods fn magic_u32() -> u32 { ... } fn file_name(base: &str, order_no: usize) -> String { ... } fn read_file(path: impl AsRef<Path>) -> Result<Self, Error> where Self: StrictDecode { ... } fn write_file(&self, path: impl AsRef<Path>) -> Result<usize, Error> where Self: Sized + StrictEncode { ... } }

Required Associated Constants§

Source

const DOC_MAGIC: [u8; 4]

Source

const FILE_EXT: &'static str

Required Associated Types§

Provided Methods§

Source

fn magic_u32() -> u32

Source

fn file_name(base: &str, order_no: usize) -> String

Source

fn read_file(path: impl AsRef<Path>) -> Result<Self, Error>
where Self: StrictDecode,

Source

fn write_file(&self, path: impl AsRef<Path>) -> Result<usize, Error>
where Self: Sized + StrictEncode,

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§

Source§

impl FileDocument for Wallet

Source§

const DOC_MAGIC: [u8; 4] = WALLET_DOC_MAGIC

Source§

const FILE_EXT: &'static str = "mcw"

Source§

type FallbackDocType = WalletSettings