pub struct Mapping {
pub pattern: EventPattern,
pub target: Target,
pub transform: Transform,
pub name: String,
pub enabled: bool,
}Expand description
A complete mapping from an input event to a target parameter, with a value transform.
Fields§
§pattern: EventPatternEvent pattern that triggers this mapping.
target: TargetTarget parameter to set when the pattern matches.
transform: TransformTransform applied to the normalized event value before scaling.
name: StringHuman-readable name for debugging and UI.
enabled: boolWhether this mapping is currently active.
Implementations§
Source§impl Mapping
impl Mapping
Sourcepub fn new(pattern: EventPattern, target: Target, transform: Transform) -> Self
pub fn new(pattern: EventPattern, target: Target, transform: Transform) -> Self
Creates a new mapping with an auto-generated name.
Sourcepub fn matches(&self, event: &ControlEvent) -> bool
pub fn matches(&self, event: &ControlEvent) -> bool
Returns true if this mapping is enabled and matches the given event.
Sourcepub fn apply(&self, event: &ControlEvent) -> Option<SetParameter>
pub fn apply(&self, event: &ControlEvent) -> Option<SetParameter>
Produces a parameter-set command if the event matches this mapping.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Mapping
impl !RefUnwindSafe for Mapping
impl Send for Mapping
impl Sync for Mapping
impl Unpin for Mapping
impl UnsafeUnpin for Mapping
impl !UnwindSafe for Mapping
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more