Skip to main content

Reply

Struct Reply 

Source
pub struct Reply {
    pub page: Option<Page>,
    pub message: Option<String>,
    pub errors: BTreeMap<String, String>,
    pub open: Option<Open>,
}
Expand description

What an action export returns, as Reply::to_json. Every part is optional; the default ends the action without a word.

Fields§

§page: Option<Page>§message: Option<String>

Shown briefly, whatever else the reply does.

§errors: BTreeMap<String, String>

Messages by field key, shown under each field, keeping the user on the page they were on with what they entered; a key of "", or one that is no field’s, is shown for the whole page.

§open: Option<Open>

An item to go to, ending the action.

Implementations§

Source§

impl Reply

Source

pub fn message(message: impl Into<String>) -> Reply

Ends the action, showing message briefly.

Source

pub fn document(markdown: impl Into<String>) -> Reply

Shows markdown alone, a report the user can copy or save as a note.

Source

pub fn page(page: Page) -> Reply

Source

pub fn error(key: impl Into<String>, message: impl Into<String>) -> Reply

Keeps the user on the page, showing message under the field key, or for the whole page when key is "".

Source

pub fn open(open: Open) -> Reply

Ends the action and goes to an item.

Source

pub fn to_json(&self) -> Result<String>

What the action export returns for this reply.

Trait Implementations§

Source§

impl Default for Reply

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Serialize for Reply

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Reply

§

impl RefUnwindSafe for Reply

§

impl Send for Reply

§

impl Sync for Reply

§

impl Unpin for Reply

§

impl UnsafeUnpin for Reply

§

impl UnwindSafe for Reply

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.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.