#[non_exhaustive]pub enum MagicRuleValidationError {
EmptyMessage,
InvalidChildLevel {
child_index: usize,
child_level: u32,
parent_level: u32,
},
LevelTooDeep {
level: u32,
max: u32,
},
}Expand description
Validation errors returned by MagicRule::validate.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
EmptyMessage
Rule message is empty. Messages are user-facing and required for meaningful output.
InvalidChildLevel
The child rule at child_index has level <= self.level,
violating the “children must nest deeper than the parent”
invariant of the hierarchical indentation-based DSL.
Fields
LevelTooDeep
Rule level exceeds the maximum supported depth. The limit is a
hardening mechanism against stack overflow during deep recursion;
libmagic files in the wild rarely go beyond 10 levels.
Trait Implementations§
Source§impl Debug for MagicRuleValidationError
impl Debug for MagicRuleValidationError
Source§impl Display for MagicRuleValidationError
impl Display for MagicRuleValidationError
Source§impl Error for MagicRuleValidationError
impl Error for MagicRuleValidationError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl PartialEq for MagicRuleValidationError
impl PartialEq for MagicRuleValidationError
impl Eq for MagicRuleValidationError
impl StructuralPartialEq for MagicRuleValidationError
Auto Trait Implementations§
impl Freeze for MagicRuleValidationError
impl RefUnwindSafe for MagicRuleValidationError
impl Send for MagicRuleValidationError
impl Sync for MagicRuleValidationError
impl Unpin for MagicRuleValidationError
impl UnsafeUnpin for MagicRuleValidationError
impl UnwindSafe for MagicRuleValidationError
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