Skip to main content

Request

Struct Request 

Source
pub struct Request {
    pub action: String,
    pub project: String,
    pub settings: Map<String, Value>,
    pub input: Map<String, Value>,
    pub context: Context,
    pub button: Option<String>,
    pub changed: Option<String>,
    pub state: Option<Value>,
    pub resumed: bool,
    pub locale: Option<String>,
}

Fields§

§action: String

Which of the manifest’s [[actions]] to run.

§project: String§settings: Map<String, Value>

The plugin’s declared settings, every key present.

§input: Map<String, Value>

A value for each field of the page the user was on; on the first call, the action’s [[actions.field]]s.

§context: Context§button: Option<String>

The id of the button pressed; none on the first call, which opens the action or runs the manifest’s fields.

§changed: Option<String>

Reserved for fields that call the action when they change; always none.

§state: Option<Value>

The last page’s state, as it was written; none on the first call.

§resumed: bool

Set on the first call after Hammer restored a run the user had left.

§locale: Option<String>

The UI’s BCP 47 tag, for replying in the user’s language; not the project’s language.

Implementations§

Source§

impl Request

Source

pub fn input<T: DeserializeOwned>(&self) -> Result<T>

The input read into a T, with a field per field of the page.

Source

pub fn state<T: DeserializeOwned>(&self) -> Option<T>

The state read into a T: none when there is none, or it is not a T.

Trait Implementations§

Source§

impl<'de> Deserialize<'de> for Request

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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.