mirror of
https://github.com/TECHNOFAB11/tmux-copyrat.git
synced 2026-02-02 17:35:12 +01:00
refactor: use custom Result
This commit is contained in:
parent
077d16311e
commit
7d1bb69c6f
8 changed files with 34 additions and 33 deletions
|
|
@ -1,4 +1,4 @@
|
|||
use crate::error;
|
||||
use crate::{error::ParseError, Result};
|
||||
|
||||
/// Catalog of available alphabets.
|
||||
///
|
||||
|
|
@ -41,7 +41,7 @@ const ALPHABETS: [(&str, &str); 21] = [
|
|||
/// Letters 'n' and 'N' are systematically removed to prevent conflict with
|
||||
/// navigation keys (arrows and 'n' 'N'). Letters 'y' and 'Y' are also removed
|
||||
/// to prevent conflict with yank/copy.
|
||||
pub fn parse_alphabet(src: &str) -> Result<Alphabet, error::ParseError> {
|
||||
pub fn parse_alphabet(src: &str) -> Result<Alphabet> {
|
||||
let alphabet_pair = ALPHABETS.iter().find(|&(name, _letters)| name == &src);
|
||||
|
||||
match alphabet_pair {
|
||||
|
|
@ -49,7 +49,7 @@ pub fn parse_alphabet(src: &str) -> Result<Alphabet, error::ParseError> {
|
|||
let letters = letters.replace(&['n', 'N', 'y', 'Y'][..], "");
|
||||
Ok(Alphabet(letters))
|
||||
}
|
||||
None => Err(error::ParseError::UnknownAlphabet),
|
||||
None => Err(ParseError::UnknownAlphabet),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue