Skip to main content

RelayVar

Enum RelayVar 

Source
pub enum RelayVar {
    Unit,
    Int(i64),
    Damage(u16),
    Accuracy(u8),
    Bool(bool),
}
Expand description

The typed value threaded through a dispatch fold (design §1.2). Mirrors Showdown’s relay variable.

Variants§

§

Unit

No meaningful payload (side-effecting events such as Residual).

§

Int(i64)

A signed integer fold value.

§

Damage(u16)

Accumulated/last damage.

§

Accuracy(u8)

An accuracy threshold in 0..=255.

§

Bool(bool)

A boolean verdict (e.g. “did the gate allow the move?”).

Implementations§

Source§

impl RelayVar

Source

pub fn as_int(self) -> i64

Read the relay as a signed integer (design §4.1). Non-Int0, so a handler can fold an int relay without hand-matching every variant.

Source

pub fn as_damage(self) -> u16

Read the relay as a damage value (design §4.1). Non-Damage0.

Source

pub fn as_accuracy(self) -> u8

Read the relay as an accuracy threshold (design §4.1). Non-Accuracy0.

Source

pub fn as_bool(self) -> bool

Read the relay as a boolean verdict (design §4.1). Non-Boolfalse.

Source

pub fn scale(self, num: u32, den: u32) -> RelayVar

Fold-friendly multiply: scale a numeric relay (Int/Damage/Accuracy) by num/den (design §4.1, the ×1.5 / ×0.5 modifier shape). Damage and accuracy clamp into their lanes; the result keeps the relay’s lane so a ModifyDamage/Accuracy/ModifyStat fold composes. A non-numeric relay passes through untouched.

Trait Implementations§

Source§

impl Clone for RelayVar

Source§

fn clone(&self) -> RelayVar

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 RelayVar

Source§

impl Debug for RelayVar

Source§

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

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

impl PartialEq for RelayVar

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for RelayVar

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