pub trait CryptoHash {
// Required methods
fn available(self) -> bool;
fn size(self) -> isize;
fn string(self) -> &'static str;
fn set(self, _: &str) -> Result<Self, Error>
where Self: Sized;
fn digester(&self) -> Box<dyn DynDigest>;
fn hash(self) -> Box<dyn DynDigest>;
fn encode(&self, _: &[u8]) -> String;
fn from_reader<R: Read>(&self, _: R) -> String;
fn from_bytes(&self, _: &[u8]) -> String;
fn from_string(&self, _: &str) -> String;
fn from_file(&self, _: &str) -> Result<String, Error>;
fn validate(&self, _: &str) -> bool;
}Expand description
CryptoHash is the interface that any hash algorithm must implement
Required Methods§
fn available(self) -> bool
fn size(self) -> isize
fn string(self) -> &'static str
fn set(self, _: &str) -> Result<Self, Error>where
Self: Sized,
fn digester(&self) -> Box<dyn DynDigest>
fn hash(self) -> Box<dyn DynDigest>
fn encode(&self, _: &[u8]) -> String
fn from_reader<R: Read>(&self, _: R) -> String
fn from_bytes(&self, _: &[u8]) -> String
fn from_string(&self, _: &str) -> String
fn from_file(&self, _: &str) -> Result<String, Error>
fn validate(&self, _: &str) -> bool
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.