Skip to main content

Trigger

Enum Trigger 

Source
pub enum Trigger {
    Momentary,
    Continuous,
}
Expand description

What kind of input an action expects.

ADR-0012. Declared rather than inferred, because the two are not interchangeable and binding one to the other is always a mistake: a fader bound to “next track” would skip a hundred tracks across one sweep, and a key bound to “set volume” has no position to send.

Variants§

§

Momentary

A press. The ordinary case, and the default an addon author should reach for.

§

Continuous

A position — a fader, 0..=16383.

The daemon coalesces these, so an action sees where the fader ended up rather than every point it passed through. An action that needs the whole gesture is a different thing and this is not it.

Implementations§

Source§

impl Trigger

Source

pub const fn as_wire(self) -> &'static str

How it is spelled on a wire.

§Why this is a method and not a match at each end

Because it was three matches, and they had to agree without anything making them. The addon-to-daemon encoder lived in run, the daemon-to-interface encoder in nobble_rpc::AddonDto::of, and the decoder between them was if a.trigger == "continuous" in the daemon — with a TypeScript === "continuous" at the far end comparing against the result. Five hand-written copies of two strings, on a round trip where a single disagreement makes a fader silently behave like a key: the decoder’s else branch is Momentary, so a renamed encoding does not fail, it degrades.

Constitution VI is about exactly that, and the remedy it prefers — generated bindings — is unavailable inside one language. One definition on the type is the next thing: nobble-core re-exports this type, so every crate downstream is looking at the same impl rather than at its own copy of the answer.

Not a display name. These are protocol tokens, lowercase because that is what is on the wire, and a renaming here is a breaking protocol change rather than a wording change. An interface wanting Momentary with a capital M writes that itself.

Source

pub fn from_wire(s: &str) -> Option<Self>

Read one back, or None if this build has no name for it.

An Option rather than a default, deliberately. The daemon’s decode used to fall back to Self::Momentary for anything unrecognised, which turns an addon built against a newer SDK into a fader that behaves like a key with nothing reported — a Principle IV collapse. Whether to refuse or to default is the caller’s decision to state out loud; this only declines to make it for them.

Trait Implementations§

Source§

impl Clone for Trigger

Source§

fn clone(&self) -> Trigger

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 Trigger

Source§

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

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

impl PartialEq for Trigger

Source§

fn eq(&self, other: &Trigger) -> 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 Copy for Trigger

Source§

impl Eq for Trigger

Source§

impl StructuralPartialEq for Trigger

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.