Action

Struct Action 

Source
pub struct Action {
    pub name: String,
    pub class: Vec<String>,
    pub method: Option<String>,
    pub href: String,
    pub title: Option<String>,
    pub media_type: Option<String>,
    pub fields: Vec<Field>,
}
Expand description

Representation of an action.

Fields§

§name: String§class: Vec<String>§method: Option<String>§href: String§title: Option<String>§media_type: Option<String>§fields: Vec<Field>

Implementations§

Source§

impl Action

Source

pub fn new<N, H>(name: N, href: H) -> Self
where N: ToString, H: ToString,

Create a new action.

§Parameters
  • name - The name of the action.
  • href - The href for the action.
Source

pub fn with<F>(self, f: F) -> Self
where F: Fn(Self) -> Self,

Apply a lambda to specify additional details on the action.

§Parameters
  • f - The lambda function to execute on the action.
Source

pub fn with_class<S>(self, value: S) -> Self
where S: ToString,

Specify a class for the action.

§Parameters
  • value - The class to specify.
Source

pub fn with_type<S>(self, value: S) -> Self
where S: ToString,

Specify a type for the action.

§Parameters
  • value - The type to specify.
Source

pub fn with_title<S>(self, value: S) -> Self
where S: ToString,

Specify a title for the action.

§Parameters
  • value - The title to specify.
Source

pub fn with_method<S>(self, value: S) -> Self
where S: ToString,

Specify an HTTP method for the action.

§Parameters
  • value - The HTTP method to specify.
Source

pub fn with_field<V>(self, value: V) -> Self
where V: Into<Field>,

Specify a field for the action.

§Parameters
  • value - The field to specify.

Trait Implementations§

Source§

impl Debug for Action

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Serialize for Action

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 Action

§

impl RefUnwindSafe for Action

§

impl Send for Action

§

impl Sync for Action

§

impl Unpin for Action

§

impl UnwindSafe for Action

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 = 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.