shardtree: Add `std::error::Error` bound to `ShardStore::Error`
This commit is contained in:
parent
1bd0a7c941
commit
fb894cdbb7
|
@ -1,7 +1,6 @@
|
|||
//! Implementation of an in-memory shard store with persistence.
|
||||
|
||||
use std::convert::Infallible;
|
||||
use std::fmt;
|
||||
|
||||
use incrementalmerkletree::Address;
|
||||
|
||||
|
@ -25,7 +24,6 @@ where
|
|||
S: ShardStore,
|
||||
S::H: Clone,
|
||||
S::CheckpointId: Clone + Ord,
|
||||
S::Error: fmt::Display,
|
||||
{
|
||||
backend: S,
|
||||
cache: MemoryShardStore<S::H, S::CheckpointId>,
|
||||
|
@ -37,7 +35,6 @@ where
|
|||
S: ShardStore,
|
||||
S::H: Clone,
|
||||
S::CheckpointId: Clone + Ord,
|
||||
S::Error: fmt::Display,
|
||||
{
|
||||
/// Loads a `CachingShardStore` from the given backend.
|
||||
pub fn load(mut backend: S) -> Result<Self, S::Error> {
|
||||
|
@ -110,7 +107,6 @@ where
|
|||
S: ShardStore,
|
||||
S::H: Clone,
|
||||
S::CheckpointId: Clone + Ord,
|
||||
S::Error: fmt::Display,
|
||||
{
|
||||
type H = S::H;
|
||||
type CheckpointId = S::CheckpointId;
|
||||
|
|
|
@ -40,7 +40,7 @@ impl<S: fmt::Display> fmt::Display for ShardTreeError<S> {
|
|||
|
||||
impl<SE> std::error::Error for ShardTreeError<SE>
|
||||
where
|
||||
SE: fmt::Debug + fmt::Display + std::error::Error + 'static,
|
||||
SE: std::error::Error + 'static,
|
||||
{
|
||||
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
|
||||
match &self {
|
||||
|
|
|
@ -94,7 +94,7 @@ impl Checkpoint {
|
|||
pub trait ShardStore {
|
||||
type H;
|
||||
type CheckpointId;
|
||||
type Error;
|
||||
type Error: std::error::Error;
|
||||
|
||||
/// Returns the subtree at the given root address, if any such subtree exists.
|
||||
fn get_shard(
|
||||
|
|
|
@ -150,8 +150,6 @@ impl<
|
|||
const DEPTH: u8,
|
||||
const SHARD_HEIGHT: u8,
|
||||
> testing::Tree<H, C> for ShardTree<S, DEPTH, SHARD_HEIGHT>
|
||||
where
|
||||
S::Error: std::fmt::Debug,
|
||||
{
|
||||
fn depth(&self) -> u8 {
|
||||
DEPTH
|
||||
|
|
Loading…
Reference in New Issue