pub struct RuleContext<'a> {
pub value: &'a Value,
pub rule_param: &'a Value,
pub messages: Option<&'a Value>,
pub rule_name: &'a str,
pub path_segments: &'a [String],
pub row_keys: &'a [usize],
pub form_data: &'a Value,
/* private fields */
}Expand description
The per-rule invocation context handed to a rule function.
Fields§
§value: &'a ValueThe field value being validated (scalar, array, or the whole array for an array-level rule).
rule_param: &'a ValueThe EFFECTIVE rule param (already resolved from any expression/condition map). Never an expression for evaluated rules; verbatim for path/pattern/ literal rules.
messages: Option<&'a Value>The field’s messages override map, if any.
rule_name: &'a strThe invoked rule name (so pattern/match aliasing resolves messages by
the actual key used).
path_segments: &'a [String]The absolute path segments of the current field (for relative path refs).
row_keys: &'a [usize]The positions of the row keys in path_segments.
form_data: &'a ValueThe full form data tree (for path-reference rules and unique siblings).
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for RuleContext<'a>
impl<'a> !Send for RuleContext<'a>
impl<'a> !Sync for RuleContext<'a>
impl<'a> !UnwindSafe for RuleContext<'a>
impl<'a> Freeze for RuleContext<'a>
impl<'a> Unpin for RuleContext<'a>
impl<'a> UnsafeUnpin for RuleContext<'a>
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