#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum BytesFormat {
Default,
Hex,
Base64,
Base64UrlSafe,
}
#[derive(Debug, Clone)]
pub struct Config {
pub(crate) bytes_format: BytesFormat,
pub(crate) hex_eip55: bool,
pub(crate) hex_prefix: bool,
}
impl Default for Config {
fn default() -> Self {
Config {
bytes_format: BytesFormat::Default,
hex_eip55: false,
hex_prefix: false,
}
}
}
impl Config {
pub fn set_bytes_default(mut self) -> Self {
self.bytes_format = BytesFormat::Default;
self
}
pub fn set_bytes_hex(mut self) -> Self {
self.bytes_format = BytesFormat::Hex;
self
}
pub fn set_bytes_base64(mut self) -> Self {
self.bytes_format = BytesFormat::Base64;
self
}
pub fn set_bytes_base64_url_safe(mut self) -> Self {
self.bytes_format = BytesFormat::Base64UrlSafe;
self
}
pub fn enable_hex_eip55(mut self) -> Self {
self.hex_eip55 = true;
self
}
pub fn disable_hex_eip55(mut self) -> Self {
self.hex_eip55 = false;
self
}
pub fn enable_hex_prefix(mut self) -> Self {
self.hex_prefix = true;
self
}
pub fn disable_hex_prefix(mut self) -> Self {
self.hex_prefix = false;
self
}
}