Compare commits
3 Commits
3957747ce4
...
cce14878a0
Author | SHA1 | Date |
---|---|---|
Benedikt Peetz | cce14878a0 | |
Benedikt Peetz | 9d2ae6d928 | |
Benedikt Peetz | 80392410f5 |
|
@ -101,7 +101,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "keymaps"
|
name = "keymaps"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"crossterm",
|
"crossterm",
|
||||||
"log",
|
"log",
|
||||||
|
|
|
@ -21,11 +21,11 @@
|
||||||
[package]
|
[package]
|
||||||
name = "keymaps"
|
name = "keymaps"
|
||||||
description = "A rust crate which provides a standardized encoding for key codes"
|
description = "A rust crate which provides a standardized encoding for key codes"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "LGPL-3.0-or-later"
|
license = "LGPL-3.0-or-later"
|
||||||
repository = "https://git.nerdcult.net/trinitrix/keymaps"
|
repository = "https://git.nerdcult.net/trinitrix/keymaps"
|
||||||
categories = ["command-line, tui, library"]
|
categories = ["command-line-interface", "data-structures", "encoding"]
|
||||||
keywords = ["keymaps", "keychords", "vim"]
|
keywords = ["keymaps", "keychords", "vim"]
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
8
NEWS.md
8
NEWS.md
|
@ -24,6 +24,14 @@ If not, see <https://www.gnu.org/licenses/>.
|
||||||
All notable changes to this project will be documented in this file. See [conventional commits](https://www.conventionalcommits.org/) for commit guidelines.
|
All notable changes to this project will be documented in this file. See [conventional commits](https://www.conventionalcommits.org/) for commit guidelines.
|
||||||
|
|
||||||
- - -
|
- - -
|
||||||
|
## [v0.1.1](https://codeberg.org/trinitrix/keymaps/compare/3957747ce4c7c19b2dafe5796577ec9aa99dbade..v0.1.1) - 2024-05-03
|
||||||
|
#### Bug Fixes
|
||||||
|
- **(Cargo.toml)** Add correct categories - ([8039241](https://codeberg.org/trinitrix/keymaps/commit/80392410f56188665c533555e8fa4fc074c2b1c8)) - [@soispha](https://codeberg.org/soispha)
|
||||||
|
- **(Cargo.toml)** Add required metadata - ([3957747](https://codeberg.org/trinitrix/keymaps/commit/3957747ce4c7c19b2dafe5796577ec9aa99dbade)) - [@soispha](https://codeberg.org/soispha)
|
||||||
|
- **(scr/error.rs)** Don't require a displayable value - ([9d2ae6d](https://codeberg.org/trinitrix/keymaps/commit/9d2ae6d928ecccaf15b7e4a3c98f9a68ad6b4f46)) - [@soispha](https://codeberg.org/soispha)
|
||||||
|
|
||||||
|
- - -
|
||||||
|
|
||||||
## [v0.1.0](https://codeberg.org/trinitrix/keymaps/compare/2f9942640a84a4aa8d34c16b839f0749893dc1d0..v0.1.0) - 2024-05-03
|
## [v0.1.0](https://codeberg.org/trinitrix/keymaps/compare/2f9942640a84a4aa8d34c16b839f0749893dc1d0..v0.1.0) - 2024-05-03
|
||||||
#### Build system
|
#### Build system
|
||||||
- **(Cargo.lock)** Check in to avoid not reproducible builds - ([de9562b](https://codeberg.org/trinitrix/keymaps/commit/de9562b6754003ad67acb90023859037f8efd22a)) - [@soispha](https://codeberg.org/soispha)
|
- **(Cargo.lock)** Check in to avoid not reproducible builds - ([de9562b](https://codeberg.org/trinitrix/keymaps/commit/de9562b6754003ad67acb90023859037f8efd22a)) - [@soispha](https://codeberg.org/soispha)
|
||||||
|
|
|
@ -20,21 +20,21 @@
|
||||||
* If not, see <https://www.gnu.org/licenses/>.
|
* If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use std::{fmt::Display, num::ParseIntError};
|
use std::num::ParseIntError;
|
||||||
|
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
use crate::key_repr::{key, keys, Keys};
|
use crate::key_repr::{key, keys, Keys};
|
||||||
|
|
||||||
#[derive(Error, Debug)]
|
#[derive(Error, Debug)]
|
||||||
pub enum TrieInsertError<V: Display> {
|
pub enum TrieInsertError<V> {
|
||||||
#[error("The key ('{0}') contains nodes, which already have a value set!")]
|
#[error("The key ('{0:#?}') contains nodes, which already have a value set!")]
|
||||||
KeyPathBlocked(Keys),
|
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 },
|
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),
|
NodeHasChildren(Keys),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,20 +29,20 @@ use crate::error;
|
||||||
use super::key_repr::{Key, Keys};
|
use super::key_repr::{Key, Keys};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq)]
|
#[derive(Debug, PartialEq, Eq)]
|
||||||
pub struct Node<V: std::fmt::Display + ToOwned<Owned = V>> {
|
pub struct Node<V> {
|
||||||
children: HashMap<Key, Box<Node<V>>>,
|
children: HashMap<Key, Box<Node<V>>>,
|
||||||
value: Option<V>,
|
value: Option<V>,
|
||||||
is_terminal: bool,
|
is_terminal: bool,
|
||||||
is_child: bool,
|
is_child: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<V: std::fmt::Display + ToOwned<Owned = V>> Default for Node<V> {
|
impl<V: ToOwned<Owned = V>> Default for Node<V> {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self::new()
|
Self::new()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<V: std::fmt::Display + ToOwned<Owned = V>> Node<V> {
|
impl<V: ToOwned<Owned = V>> Node<V> {
|
||||||
pub fn new() -> Node<V> {
|
pub fn new() -> Node<V> {
|
||||||
Node {
|
Node {
|
||||||
children: HashMap::new(),
|
children: HashMap::new(),
|
||||||
|
|
Reference in New Issue