pub struct Validation {
pub selection_change: Option<Selection>,
pub text_change: Option<String>,
/* private fields */
}Expand description
The result of a Formatter attempting to validate some partial input.
Fields§
§selection_change: Option<Selection>A manual selection override.
This will be set as the new selection (regardless of whether or not validation succeeded or failed)
text_change: Option<String>A manual text override.
This will be set as the new text, regardless of whether or not validation failed.
Implementations§
Source§impl Validation
impl Validation
Sourcepub fn failure(err: impl Error + 'static) -> Self
pub fn failure(err: impl Error + 'static) -> Self
Create a Validation with an error indicating the failure reason.
Sourcepub fn change_text(self, text: String) -> Self
pub fn change_text(self, text: String) -> Self
Optionally set a String that will replace the current contents.
Sourcepub fn change_selection(self, sel: Selection) -> Self
pub fn change_selection(self, sel: Selection) -> Self
Optionally set a Selection that will replace the current one.
Sourcepub fn error(&self) -> Option<&ValidationError>
pub fn error(&self) -> Option<&ValidationError>
If validation failed, return the underlying ValidationError.
Auto Trait Implementations§
impl Freeze for Validation
impl !RefUnwindSafe for Validation
impl !Send for Validation
impl !Sync for Validation
impl Unpin for Validation
impl !UnwindSafe for Validation
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
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, U> RoundInto<U> for Twhere
U: RoundFrom<T>,
impl<T, U> RoundInto<U> for Twhere
U: RoundFrom<T>,
Source§fn round_into(self) -> U
fn round_into(self) -> U
Performs the conversion.