Skip to main content

Action

Enum Action 

Source
pub enum Action {
Show 19 variants Create(VesselRequest), Become(VesselRequest), Enter(VesselRequest), Leave, Take(VesselRequest), Drop(VesselRequest), Move { object_article: Option<Article>, object_name: String, preposition: IntoPrep, target_article: Option<Article>, target_name: String, }, Look { preposition: Option<AtPrep>, basic: Option<VesselRequest>, }, Transform { preposition: Option<IntoPrep>, basic: VesselRequest, }, Note { text: Option<String>, }, Warp { preposition: Option<IntoPrep>, basic: VesselRequest, }, Program(Option<VesselRequest>), Use(VesselRequest), Cast { spell: VesselRequest, preposition: OnPrep, target: VesselRequest, }, Save { filename: Option<String>, }, Load { filename: Option<String>, }, Debug, Exit, Learn { preposition: Option<AboutPrep>, topic: Option<Verb>, },
}
Expand description

An action to be executed by the system interface.

Variants§

§

Create(VesselRequest)

Creates a new vessel adjacent to the user’s.

§

Become(VesselRequest)

Takes control of an adjacent vessel.

§

Enter(VesselRequest)

Moves the controlled vessel into an adjacent vessel.

§

Leave

Moves the controlled vessel out of its parent, into its parent’s parent.

§

Take(VesselRequest)

Moves an adjacent vessel into the controlled vessel.

§

Drop(VesselRequest)

Moves a vessel inside the controlled vessel into the controlled vessel’s parent.

§

Move

Moves an adjacent vessel into another adjacent vessel.

Fields

§object_article: Option<Article>

The optional Article with which to refer to the object being moved.

§object_name: String

The name/key of the object being moved.

§preposition: IntoPrep

The preposition separating the two crate::vessel::Vessels.

§target_article: Option<Article>

The optional Article with which to refer to the target being moved to.

§target_name: String

The name/key of the target being moved to.

§

Look

Displays a list of the adjacent vessels, or of the vessels inside an adjacent vessel.

Fields

§preposition: Option<AtPrep>

An optional preposition before the crate::vessel::Vessel being specified.

§basic: Option<VesselRequest>

An optional set of identifiers for a crate::vessel::Vessel to look at/inside.

§

Transform

Renames the controlled vessel.

Fields

§preposition: Option<IntoPrep>

An optional preposition before the crate::vessel::Vessel being specified.

§basic: VesselRequest

A set of identifiers for the crate::vessel::Vessel’s new name and Article.

§

Note

Assigns a description to the parent of the controlled vessel.

Fields

§text: Option<String>

The description text, to which the note will be set.

§

Warp

Moves the controlled vessel into another vessel, regardless of adjacency.

Fields

§preposition: Option<IntoPrep>

An optional preposition before the crate::vessel::Vessel being specified.

§basic: VesselRequest

A set of identifiers for the crate::vessel::Vessel being moved to.

§

Program(Option<VesselRequest>)

Begins programming a task for an adjacent vessel.

§

Use(VesselRequest)

Executes an adjacent vessel’s program.

§

Cast

Executes a distant vessel’s program as another vessel.

Fields

§spell: VesselRequest

A set of identifiers for the crate::vessel::Vessel whose program should be run.

§preposition: OnPrep

The preposition separating the two crate::vessel::Vessels.

§target: VesselRequest

A set of identifiers for the crate::vessel::Vessel for the program to run as.

§

Save

Saves the state of all vessels to a file.

Fields

§filename: Option<String>

The name of the file to be saved to.

§

Load

Loads the state of all vessels from a file.

Fields

§filename: Option<String>

The name of the file to be loaded from.

§

Debug

Displays the state of all vessels as raw json data.

§

Exit

Exits parade, or stops programming a vessel if the user is doing so.

§

Learn

Displays general information on Parade, or information on a specific action.

Fields

§preposition: Option<AboutPrep>

An optional preposition before the help topic being specified.

§topic: Option<Verb>

The optional help topic, to have its Verb::help_text displayed.

Implementations§

Source§

impl Action

Source

pub fn from_vessel_request( verb: Verb, basic: VesselRequest, ) -> Result<Self, Error>

Wraps a VesselRequest in an Action, if the Verb refers to an Action that wraps a VesselRequest.

§Errors

This method fails if the Verb refers to an Action which does not exclusively wrap a VesselRequest. The viable Verbs are:

Source

pub fn parse(action_string: &str) -> Result<Option<Action>, Error>

Parse a user-provided action string into an Action (or none, if the user entered nothing).

§Errors

This method fails if the string does not match the requirements of the given Action, or specifies a Verb which does not exist.

Trait Implementations§

Source§

impl Clone for Action

Source§

fn clone(&self) -> Action

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Action

Source§

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

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

impl<'de> Deserialize<'de> for Action

Source§

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

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for Action

Source§

impl Ord for Action

Source§

fn cmp(&self, other: &Action) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Action

Source§

fn eq(&self, other: &Action) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Action

Source§

fn partial_cmp(&self, other: &Action) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. 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
Source§

impl StructuralPartialEq for Action

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> 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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.