diff options
author | Valentin Popov <valentin@popov.link> | 2024-07-19 15:37:58 +0300 |
---|---|---|
committer | Valentin Popov <valentin@popov.link> | 2024-07-19 15:37:58 +0300 |
commit | a990de90fe41456a23e58bd087d2f107d321f3a1 (patch) | |
tree | 15afc392522a9e85dc3332235e311b7d39352ea9 /vendor/dialoguer/src/validate.rs | |
parent | 3d48cd3f81164bbfc1a755dc1d4a9a02f98c8ddd (diff) | |
download | fparkan-a990de90fe41456a23e58bd087d2f107d321f3a1.tar.xz fparkan-a990de90fe41456a23e58bd087d2f107d321f3a1.zip |
Deleted vendor folder
Diffstat (limited to 'vendor/dialoguer/src/validate.rs')
-rw-r--r-- | vendor/dialoguer/src/validate.rs | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/vendor/dialoguer/src/validate.rs b/vendor/dialoguer/src/validate.rs deleted file mode 100644 index addc9b4..0000000 --- a/vendor/dialoguer/src/validate.rs +++ /dev/null @@ -1,49 +0,0 @@ -//! Provides validation for text inputs - -/// Trait for input validators. -/// -/// A generic implementation for `Fn(&str) -> Result<(), E>` is provided -/// to facilitate development. -pub trait Validator<T> { - type Err; - - /// Invoked with the value to validate. - /// - /// If this produces `Ok(())` then the value is used and parsed, if - /// an error is returned validation fails with that error. - fn validate(&mut self, input: &T) -> Result<(), Self::Err>; -} - -impl<T, F, E> Validator<T> for F -where - F: FnMut(&T) -> Result<(), E>, -{ - type Err = E; - - fn validate(&mut self, input: &T) -> Result<(), Self::Err> { - self(input) - } -} - -/// Trait for password validators. -#[allow(clippy::ptr_arg)] -pub trait PasswordValidator { - type Err; - - /// Invoked with the value to validate. - /// - /// If this produces `Ok(())` then the value is used and parsed, if - /// an error is returned validation fails with that error. - fn validate(&self, input: &String) -> Result<(), Self::Err>; -} - -impl<F, E> PasswordValidator for F -where - F: Fn(&String) -> Result<(), E>, -{ - type Err = E; - - fn validate(&self, input: &String) -> Result<(), Self::Err> { - self(input) - } -} |