pub struct Messages { /* private fields */ }Expand description
Message defaults, plus whatever the application overrode.
Implementations§
Source§impl Messages
impl Messages
pub fn new() -> Self
Sourcepub fn set(&mut self, key: impl Into<String>, message: impl Into<String>)
pub fn set(&mut self, key: impl Into<String>, message: impl Into<String>)
Override a message.
The key is "field.rule" for one field ("email.required") or just
"rule" to replace the default everywhere ("required"). Placeholders
still interpolate, so an override can keep :attribute.
Sourcepub fn with(self, key: impl Into<String>, message: impl Into<String>) -> Self
pub fn with(self, key: impl Into<String>, message: impl Into<String>) -> Self
The chaining form of Messages::set.
Sourcepub fn set_attribute(
&mut self,
field: impl Into<String>,
label: impl Into<String>,
)
pub fn set_attribute( &mut self, field: impl Into<String>, label: impl Into<String>, )
Rename a field for display: attribute("dob", "date of birth").
Sourcepub fn attribute(
self,
field: impl Into<String>,
label: impl Into<String>,
) -> Self
pub fn attribute( self, field: impl Into<String>, label: impl Into<String>, ) -> Self
The chaining form of Messages::set_attribute.
Trait Implementations§
impl StructuralPartialEq for Messages
Auto Trait Implementations§
impl Freeze for Messages
impl RefUnwindSafe for Messages
impl Send for Messages
impl Sync for Messages
impl Unpin for Messages
impl UnsafeUnpin for Messages
impl UnwindSafe for Messages
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