Skip to main content

Action

Enum Action 

Source
#[non_exhaustive]
pub enum Action {
Show 16 variants Orbit, Pan, Zoom, FocusObject, ResetView, EnterFlyMode, FlyForward, FlyBackward, FlyLeft, FlyRight, FlyUp, FlyDown, FlySpeedBoost, Confirm, Cancel, Custom(u32),
}
Expand description

Semantic actions that can be triggered by user input.

Actions are decoupled from their physical triggers (keys/mouse buttons), so bindings can be remapped and the same action can be reached through different triggers depending on context. The named variants are the ones the library’s controllers act on, plus Confirm and Cancel for any modal tool; an application or a tool crate binds its own actions to Action::Custom.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Orbit

Rotate the camera around the orbit centre (arcball).

§

Pan

Translate the orbit centre in the camera plane.

§

Zoom

Zoom in/out by adjusting camera distance.

§

FocusObject

Frame the selected object (zoom-to-fit).

§

ResetView

Reset camera to the default view.

§

EnterFlyMode

Enter first-person fly-through mode.

§

FlyForward

Move forward in fly mode.

§

FlyBackward

Move backward in fly mode.

§

FlyLeft

Strafe left in fly mode.

§

FlyRight

Strafe right in fly mode.

§

FlyUp

Move up in fly mode.

§

FlyDown

Move down in fly mode.

§

FlySpeedBoost

Hold to increase fly-mode movement speed.

§

Confirm

Confirm the current operation (Enter / left-click).

§

Cancel

Cancel the current operation (Escape / right-click).

§

Custom(u32)

An action the application defines. The library binds nothing to it and never acts on it; the resolver reports it like any other action, so an application shortcut gets the same gestures, modifiers and keyboard ownership as a built-in one. Give each shortcut its own constant. Library crates take values from 0x1000_0000 upwards; an application keeps the range below.

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 Copy for Action

Source§

impl Debug for Action

Source§

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

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

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

Source§

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

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

impl Eq for Action

Source§

impl Hash for Action

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Action

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl Serialize for Action

Source§

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

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Action

Auto Trait Implementations§

§

impl Forget for Action

§

impl Freeze for Action

§

impl Move for Action

§

impl RefUnwindSafe for Action

§

impl Send for Action

§

impl Sync for Action

§

impl Unpin for Action

§

impl UnsafeUnpin 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> 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> 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 = !

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.