pub struct Mapping {
mappings: FnvHashMap<EvCode, AxisOrBtn>,
name: String,
default: bool,
hats_mapped: u8,
}
Expand description
Store mappings from one EvCode
(u16
) to another.
This struct is internal, MappingData
is exported in public interface as Mapping
.
Fields§
§mappings: FnvHashMap<EvCode, AxisOrBtn>
§name: String
§default: bool
§hats_mapped: u8
Implementations§
source§impl Mapping
impl Mapping
pub fn new() -> Self
pub fn default(gamepad: &Gamepad) -> Self
pub fn name(&self) -> &str
pub fn from_data( data: &MappingData, buttons: &[EvCode], axes: &[EvCode], name: &str, uuid: Uuid, ) -> Result<(Self, String), MappingError>
pub fn parse_sdl_mapping( line: &str, buttons: &[EvCode], axes: &[EvCode], ) -> Result<Self, ParseSdlMappingError>
fn add_axis( ident: &str, ev_code: EvCode, mapped_axis: Axis, axes: &[EvCode], sdl_mappings: &mut String, mappings: &mut FnvHashMap<EvCode, AxisOrBtn>, ) -> Result<(), MappingError>
fn is_name_valid(name: &str) -> bool
pub fn map(&self, code: &EvCode) -> Option<AxisOrBtn>
pub fn map_rev(&self, el: &AxisOrBtn) -> Option<EvCode>
pub fn is_default(&self) -> bool
sourcepub fn hats_mapped(&self) -> u8
pub fn hats_mapped(&self) -> u8
Return bit field with mapped hats. Only for mappings created from SDL format this function can return non-zero value.
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 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