pub struct Editor { /* private fields */ }Implementations§
Source§impl Editor
impl Editor
Sourcepub const DEFAULT_LEVELS: &'static str = "5"
pub const DEFAULT_LEVELS: &'static str = "5"
The rubric used when the levels field is left blank.
Sourcepub fn adding(fallback_id: String) -> Self
pub fn adding(fallback_id: String) -> Self
A new question. The id and levels fields start empty, with their fallbacks offered as hints on the field itself.
Pre-filling a field and leaving the cursor in it is what turned a typed “urgent” into “urgentq1” and a typed rubric into “5unkritisch, gering, …”. Both were found by driving the real binary, and both are the same mistake: a default belongs beside the field, not inside it. An empty field types cleanly, and leaving it blank still gives something usable.
pub fn editing(draft: QuestionDraft, index: usize) -> Self
Sourcepub fn fallback_id(&self) -> &str
pub fn fallback_id(&self) -> &str
The id that will be used if the field is left blank.
Sourcepub fn is_blank(&self, field: Field) -> bool
pub fn is_blank(&self, field: Field) -> bool
Whether field is empty and will therefore fall back to its default.
pub fn kind(&self) -> Kind
pub fn focused(&self) -> Field
pub fn is_editing(&self) -> bool
Sourcepub fn fields(&self) -> Vec<Field>
pub fn fields(&self) -> Vec<Field>
The fields this kind actually uses, in tab order.
Options belong to a choice and levels to a score, so tabbing skips the one that would do
nothing. The text behind it is kept either way — see QuestionDraft.
pub fn field(&self, field: Field) -> &TextArea<'static>
pub fn focus_next(&mut self)
pub fn focus_previous(&mut self)
pub fn cycle_kind(&mut self, forward: bool)
Sourcepub fn input(&mut self, key: KeyEvent) -> bool
pub fn input(&mut self, key: KeyEvent) -> bool
Feed a key to the focused field. Returns false when the key was not consumed, so the caller can treat it as a shortcut.
Sourcepub fn finish(self) -> (QuestionDraft, Option<usize>)
pub fn finish(self) -> (QuestionDraft, Option<usize>)
The draft as typed, plus the slot it belongs in.
Auto Trait Implementations§
impl !Freeze for Editor
impl !RefUnwindSafe for Editor
impl !Sync for Editor
impl Send for Editor
impl Unpin for Editor
impl UnsafeUnpin for Editor
impl UnwindSafe for Editor
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
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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