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§
§impl Validation
impl Validation
pub fn success() -> Validation
pub fn success() -> Validation
Create a Validation indicating success.
pub fn failure(err: impl Error + 'static) -> Validation
pub fn failure(err: impl Error + 'static) -> Validation
Create a Validation with an error indicating the failure reason.
pub fn change_text(self, text: String) -> Validation
pub fn change_text(self, text: String) -> Validation
Optionally set a String that will replace the current contents.
pub fn change_selection(self, sel: Selection) -> Validation
pub fn change_selection(self, sel: Selection) -> Validation
Optionally set a Selection that will replace the current one.
pub fn error(&self) -> Option<&ValidationError>
pub fn error(&self) -> Option<&ValidationError>
If validation failed, return the underlying ValidationError.
Auto Trait Implementations§
impl !RefUnwindSafe for Validation
impl !Send for Validation
impl !Sync for Validation
impl Unpin for Validation
impl !UnwindSafe for Validation
Blanket Implementations§
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> RoundFrom<T> for T
impl<T> RoundFrom<T> for T
§fn round_from(x: T) -> T
fn round_from(x: T) -> T
Performs the conversion.
§impl<T, U> RoundInto<U> for Twhere
U: RoundFrom<T>,
impl<T, U> RoundInto<U> for Twhere U: RoundFrom<T>,
§fn round_into(self) -> U
fn round_into(self) -> U
Performs the conversion.