pub struct ValidationRegistry { /* private fields */ }
Expand description
Registry that manages multiple option providers
Implementations§
Source§impl ValidationRegistry
impl ValidationRegistry
Sourcepub fn register_provider(&mut self, provider: Box<dyn OptionProvider>)
pub fn register_provider(&mut self, provider: Box<dyn OptionProvider>)
Register a new option provider
Sourcepub fn get_providers(&self) -> &[Box<dyn OptionProvider>]
pub fn get_providers(&self) -> &[Box<dyn OptionProvider>]
Get all providers
Sourcepub fn get_options(&self, command: &str) -> Vec<OptionDef>
pub fn get_options(&self, command: &str) -> Vec<OptionDef>
Get options for a command from all applicable providers
Sourcepub fn validate_option(
&self,
command: &str,
option: &str,
value: Option<&str>,
config: &ValidationConfig,
) -> ValidationResult<()>
pub fn validate_option( &self, command: &str, option: &str, value: Option<&str>, config: &ValidationConfig, ) -> ValidationResult<()>
Validate an option using the appropriate provider
Sourcepub fn suggest_option(&self, command: &str, option: &str) -> Vec<String>
pub fn suggest_option(&self, command: &str, option: &str) -> Vec<String>
Get suggestions for a misspelled option
Sourcepub fn validate_conflicts(
&self,
command: &str,
options: &HashMap<String, Option<String>>,
) -> ValidationResult<()>
pub fn validate_conflicts( &self, command: &str, options: &HashMap<String, Option<String>>, ) -> ValidationResult<()>
Validate conflicts between options
Sourcepub fn validate_requirements(
&self,
command: &str,
options: &HashMap<String, Option<String>>,
) -> ValidationResult<()>
pub fn validate_requirements( &self, command: &str, options: &HashMap<String, Option<String>>, ) -> ValidationResult<()>
Validate required options
Sourcepub fn get_provider(&self, name: &str) -> Option<&dyn OptionProvider>
pub fn get_provider(&self, name: &str) -> Option<&dyn OptionProvider>
Get provider by name
Sourcepub fn supports_command(&self, command: &str) -> bool
pub fn supports_command(&self, command: &str) -> bool
Check if any provider supports a command
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ValidationRegistry
impl !RefUnwindSafe for ValidationRegistry
impl Send for ValidationRegistry
impl Sync for ValidationRegistry
impl Unpin for ValidationRegistry
impl !UnwindSafe for ValidationRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more