pub struct LookupValidator;Expand description
The accept-all base for lookup-style validators — it accepts every input.
Use LookupValidator as a stand-in when you need a no-op validator in a
context that expects a lookup-style type, or as the starting point before
you know which concrete validator to plug in. For actual membership testing,
use StringLookupValidator instead.
§Turbo Vision heritage
Ports TLookupValidator (tvalidator.cpp), an abstract intermediate that
routed validity through a virtual lookup step. In tvision-rs the indirection
collapses: each concrete lookup validator folds the lookup directly into its
is_valid, so this type only realises the base’s accept-all behaviour.
Implementations§
Trait Implementations§
Source§impl Default for LookupValidator
impl Default for LookupValidator
Source§impl Validator for LookupValidator
Accept-all: all default methods from the base Validator trait suffice.
impl Validator for LookupValidator
Accept-all: all default methods from the base Validator trait suffice.
Source§fn is_valid_input(&self, _s: &mut String, _suppress_fill: bool) -> bool
fn is_valid_input(&self, _s: &mut String, _suppress_fill: bool) -> bool
Check (and optionally auto-fill/modify)
s as it is being typed. May
mutate s in place (e.g. a picture validator inserting literal
characters). suppress_fill asks it not to auto-fill. Default: accept, no
change. Object-safe: &self, s: &mut String.Source§fn error(&self, _ctx: &mut Context<'_>)
fn error(&self, _ctx: &mut Context<'_>)
Report an invalid final value. Concrete validators pop up a message box via
the async-modal-from-a-view seam (
Context::request_message_box,
answer_to/then_command both None — informational, OK-only); the base
is a no-op. Read moreSource§fn validate(&self, s: &str, ctx: &mut Context<'_>) -> bool
fn validate(&self, s: &str, ctx: &mut Context<'_>) -> bool
Validate
s and, if invalid, pop the error box. Call this at the
field-commit point (modal OK / focus release): it calls is_valid, and on
failure calls error to display the message box before returning false.
Returns true immediately when valid without touching the context. Read moreSource§fn is_status_ok(&self) -> bool
fn is_status_ok(&self) -> bool
Whether the validator’s status is OK — consulted when the field must
commit. The base never enters a non-OK status, so the default is
true;
PXPictureValidator overrides to report a malformed mask.Source§fn transfer_get(&self, _s: &str) -> Option<FieldValue>
fn transfer_get(&self, _s: &str) -> Option<FieldValue>
Report the field’s current text
s as a typed FieldValue during a
dialog gather walk. Return Some(typed value) when the validator has
transfer enabled and can parse the text; return None to leave the input
line carrying its plain text (the default, meaning “I don’t transfer”). Read moreSource§fn transfer_set(&self, _v: &FieldValue) -> Option<String>
fn transfer_set(&self, _v: &FieldValue) -> Option<String>
Format a typed
FieldValue back to the field’s text during a dialog
scatter walk. Return Some(text) when transfer is enabled and v
is the type this validator handles; return None to leave the input line
on its own text path (the default). Read moreAuto Trait Implementations§
impl Freeze for LookupValidator
impl RefUnwindSafe for LookupValidator
impl Send for LookupValidator
impl Sync for LookupValidator
impl Unpin for LookupValidator
impl UnsafeUnpin for LookupValidator
impl UnwindSafe for LookupValidator
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.