pub struct Draft {
pub tag: String,
pub kind: ProviderKind,
pub base: String,
pub key: String,
pub problem: Option<Problem>,
}Expand description
A provider being written down.
Fields§
§tag: StringThe tag as it has been typed.
kind: ProviderKindWhich kind it is.
base: StringThe address as it has been typed.
key: StringThe key as it is being typed. Never shown back: the field it lives in is a password field, and once the provider is added this is gone.
problem: Option<Problem>What stopped it last time the person asked for it to be added, or nothing while they have not asked yet. A form does not complain about a field nobody has finished.
Implementations§
Source§impl Draft
impl Draft
Sourcepub fn new() -> Self
pub fn new() -> Self
A new form, on the kind the page offers first, with that kind’s usual address already in the field so the common case is one word of typing.
Sourcepub fn pick_kind(&mut self, kind: ProviderKind)
pub fn pick_kind(&mut self, kind: ProviderKind)
Chooses a kind, and moves the address along with it when the person has not changed the one that was offered. A person who typed their own address keeps it. A ready-made kind brings its own tag too, on the same terms: only into a field the person has not written.
Sourcepub fn pick_region(&mut self, index: usize)
pub fn pick_region(&mut self, index: usize)
Chooses where a ready-made provider answers, the indexth of its kind’s regions. The
address is the region’s whatever was in the field: picking a region is saying which
address, and nothing else does that.
Sourcepub fn region(&self) -> Option<usize>
pub fn region(&self) -> Option<usize>
Which of the kind’s regions the address is, or None when the person wrote one of their
own.
Trait Implementations§
impl Eq for Draft
impl StructuralPartialEq for Draft
Auto Trait Implementations§
impl Freeze for Draft
impl RefUnwindSafe for Draft
impl Send for Draft
impl Sync for Draft
impl Unpin for Draft
impl UnsafeUnpin for Draft
impl UnwindSafe for Draft
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more