Skip to content

Commit

Permalink
shardtree: Add std::error::Error bound to ShardStore::Error
Browse files Browse the repository at this point in the history
  • Loading branch information
str4d committed Jul 25, 2023
1 parent 1bd0a7c commit fb894cd
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 8 deletions.
4 changes: 0 additions & 4 deletions shardtree/src/caching.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//! Implementation of an in-memory shard store with persistence.

use std::convert::Infallible;
use std::fmt;

use incrementalmerkletree::Address;

Expand All @@ -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>,
Expand All @@ -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> {
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion shardtree/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion shardtree/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 0 additions & 2 deletions shardtree/src/testing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fb894cd

Please sign in to comment.