From 9d2ae6d928ecccaf15b7e4a3c98f9a68ad6b4f46 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Fri, 3 May 2024 21:04:06 +0200 Subject: [PATCH] fix(scr/error.rs): Don't require a displayable value --- src/error/mod.rs | 10 +++++----- src/trie.rs | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/error/mod.rs b/src/error/mod.rs index 5af1394..e9f26be 100644 --- a/src/error/mod.rs +++ b/src/error/mod.rs @@ -20,21 +20,21 @@ * If not, see . */ -use std::{fmt::Display, num::ParseIntError}; +use std::num::ParseIntError; use thiserror::Error; use crate::key_repr::{key, keys, Keys}; #[derive(Error, Debug)] -pub enum TrieInsertError { - #[error("The key ('{0}') contains nodes, which already have a value set!")] +pub enum TrieInsertError { + #[error("The key ('{0:#?}') contains nodes, which already have a value set!")] KeyPathBlocked(Keys), - #[error("The key ('{key}') already has a value associatet with it, which is: '{value}'")] + #[error("The key ('{key:#?}') already has a value associatet with it, which is: '{value}'")] KeyAlreadySet { key: Keys, value: V }, - #[error("The node accessed by this key ('{0}') already has children! You can not set a value for it")] + #[error("The node accessed by this key ('{0:#?}') already has children! You can not set a value for it")] NodeHasChildren(Keys), } diff --git a/src/trie.rs b/src/trie.rs index 55f9c88..1552330 100644 --- a/src/trie.rs +++ b/src/trie.rs @@ -29,20 +29,20 @@ use crate::error; use super::key_repr::{Key, Keys}; #[derive(Debug, PartialEq, Eq)] -pub struct Node> { +pub struct Node { children: HashMap>>, value: Option, is_terminal: bool, is_child: bool, } -impl> Default for Node { +impl> Default for Node { fn default() -> Self { Self::new() } } -impl> Node { +impl> Node { pub fn new() -> Node { Node { children: HashMap::new(),