use std::future::Future;
use multihash::Multihash;
use tokio::io::AsyncRead;
use crate::object_hash::error::Error;
pub trait Hash {
fn multihash(&self) -> &Multihash<256>;
fn algorithm(&self) -> u64 {
self.multihash().code()
}
fn digest(&self) -> &[u8] {
self.multihash().digest()
}
fn from_reader<R: AsyncRead + Unpin + Send>(
reader: R,
length: u64,
) -> impl Future<Output = Result<Self, Error>> + Send
where
Self: Sized;
}