Skip to main content

Editor

Struct Editor 

Source
pub struct Editor { /* private fields */ }

Implementations§

Source§

impl Editor

Source

pub const DEFAULT_LEVELS: &'static str = "5"

The rubric used when the levels field is left blank.

Source

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.

Source

pub fn editing(draft: QuestionDraft, index: usize) -> Self

Source

pub fn fallback_id(&self) -> &str

The id that will be used if the field is left blank.

Source

pub fn is_blank(&self, field: Field) -> bool

Whether field is empty and will therefore fall back to its default.

Source

pub fn kind(&self) -> Kind

Source

pub fn focused(&self) -> Field

Source

pub fn is_editing(&self) -> bool

Source

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.

Source

pub fn field(&self, field: Field) -> &TextArea<'static>

Source

pub fn set(&mut self, field: Field, value: &str)

Replace a field’s contents outright.

Source

pub fn focus_next(&mut self)

Source

pub fn focus_previous(&mut self)

Source

pub fn cycle_kind(&mut self, forward: bool)

Source

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.

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more