pub struct ValidationRuleSet {
pub complexity_warning: u32,
pub complexity_critical: u32,
pub max_function_length: usize,
pub max_nesting_depth: u32,
pub max_file_length: usize,
pub min_name_length: usize,
pub max_name_length: usize,
}Expand description
Configurable rule set for validation thresholds.
This struct allows dynamic configuration of validation rules, enabling different strictness levels for different contexts.
Fields§
§complexity_warning: u32Complexity threshold for warnings (default: 21).
complexity_critical: u32Complexity threshold for critical issues (default: 100).
max_function_length: usizeMaximum function length in lines (default: 50).
max_nesting_depth: u32Maximum nesting depth (default: 4).
max_file_length: usizeMaximum file length in lines (default: 1000).
min_name_length: usizeMinimum name length for identifiers (default: 2).
max_name_length: usizeMaximum name length for identifiers (default: 50).
Implementations§
Source§impl ValidationRuleSet
impl ValidationRuleSet
Sourcepub fn is_warning_complexity(&self, complexity: u32) -> bool
pub fn is_warning_complexity(&self, complexity: u32) -> bool
Check if complexity is in the warning zone.
Sourcepub fn is_critical_complexity(&self, complexity: u32) -> bool
pub fn is_critical_complexity(&self, complexity: u32) -> bool
Check if complexity is critical.
Sourcepub fn is_acceptable_function_length(&self, length: usize) -> bool
pub fn is_acceptable_function_length(&self, length: usize) -> bool
Check if function length is acceptable.
Sourcepub fn is_acceptable_nesting(&self, depth: u32) -> bool
pub fn is_acceptable_nesting(&self, depth: u32) -> bool
Check if nesting depth is acceptable.
Sourcepub fn is_acceptable_file_length(&self, length: usize) -> bool
pub fn is_acceptable_file_length(&self, length: usize) -> bool
Check if file length is acceptable.
Sourcepub fn complexity_predicate(&self) -> impl Predicate<u32> + '_
pub fn complexity_predicate(&self) -> impl Predicate<u32> + '_
Create a complexity predicate for this rule set.
Sourcepub fn function_length_predicate(&self) -> impl Predicate<usize> + '_
pub fn function_length_predicate(&self) -> impl Predicate<usize> + '_
Create a function length predicate for this rule set.
Sourcepub fn nesting_predicate(&self) -> impl Predicate<u32> + '_
pub fn nesting_predicate(&self) -> impl Predicate<u32> + '_
Create a nesting depth predicate for this rule set.
Sourcepub fn file_length_predicate(&self) -> impl Predicate<usize> + '_
pub fn file_length_predicate(&self) -> impl Predicate<usize> + '_
Create a file length predicate for this rule set.
Trait Implementations§
Source§impl Clone for ValidationRuleSet
impl Clone for ValidationRuleSet
Source§fn clone(&self) -> ValidationRuleSet
fn clone(&self) -> ValidationRuleSet
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ValidationRuleSet
impl Debug for ValidationRuleSet
Auto Trait Implementations§
impl Freeze for ValidationRuleSet
impl RefUnwindSafe for ValidationRuleSet
impl Send for ValidationRuleSet
impl Sync for ValidationRuleSet
impl Unpin for ValidationRuleSet
impl UnsafeUnpin for ValidationRuleSet
impl UnwindSafe for ValidationRuleSet
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> EnsureExt<T> for T
impl<T> EnsureExt<T> for T
Source§fn ensure<P, E>(self, predicate: P, error: E) -> Validation<T, NonEmptyVec<E>>where
P: Predicate<T>,
fn ensure<P, E>(self, predicate: P, error: E) -> Validation<T, NonEmptyVec<E>>where
P: Predicate<T>,
Source§fn ensure_with<P, E, F>(
self,
predicate: P,
error_fn: F,
) -> Validation<T, NonEmptyVec<E>>
fn ensure_with<P, E, F>( self, predicate: P, error_fn: F, ) -> Validation<T, NonEmptyVec<E>>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more