pub struct GamepadMotion {
pub gamepad_id: u64,
pub axis: i32,
pub value: f64,
}
Expand description
§072 - Gamepad Motion
This message, which must originate from the client on the same stream as the
original 030 - Attach
message, indicates movement on a joystick or trigger.
Fields§
§gamepad_id: u64
Required.
axis: i32
Required.
value: f64
Required, with a value from -1.0 (towards the top of the gamepad) to 1.0 (towards the bottom of the gamepad). Zero always represents the resting position, and triggers will therefore usually range from 0.0 to 1.0 (fully pressed).
Implementations§
Source§impl GamepadMotion
impl GamepadMotion
Sourcepub fn axis(&self) -> GamepadAxis
pub fn axis(&self) -> GamepadAxis
Returns the enum value of axis
, or the default if the field is set to an invalid enum value.
Sourcepub fn set_axis(&mut self, value: GamepadAxis)
pub fn set_axis(&mut self, value: GamepadAxis)
Sets axis
to the provided enum value.
Trait Implementations§
Source§impl Clone for GamepadMotion
impl Clone for GamepadMotion
Source§fn clone(&self) -> GamepadMotion
fn clone(&self) -> GamepadMotion
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for GamepadMotion
impl Debug for GamepadMotion
Source§impl Default for GamepadMotion
impl Default for GamepadMotion
Source§impl From<GamepadMotion> for MessageType
impl From<GamepadMotion> for MessageType
Source§fn from(v: GamepadMotion) -> Self
fn from(v: GamepadMotion) -> Self
Converts to this type from the input type.
Source§impl Message for GamepadMotion
impl Message for GamepadMotion
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Returns the encoded length of the message without a length delimiter.
Source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
Encodes the message to a buffer. Read more
Source§fn encode_to_vec(&self) -> Vec<u8>where
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8>where
Self: Sized,
Encodes the message to a newly allocated buffer.
Source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
Encodes the message with a length-delimiter to a buffer. Read more
Source§fn encode_length_delimited_to_vec(&self) -> Vec<u8>where
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8>where
Self: Sized,
Encodes the message with a length-delimiter to a newly allocated buffer.
Source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Decodes an instance of the message from a buffer. Read more
Source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Decodes a length-delimited instance of the message from the buffer.
Source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
Decodes an instance of the message from a buffer, and merges it into
self
. Read moreSource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
Decodes a length-delimited instance of the message from buffer, and
merges it into
self
.Source§impl PartialEq for GamepadMotion
impl PartialEq for GamepadMotion
impl Copy for GamepadMotion
impl StructuralPartialEq for GamepadMotion
Auto Trait Implementations§
impl Freeze for GamepadMotion
impl RefUnwindSafe for GamepadMotion
impl Send for GamepadMotion
impl Sync for GamepadMotion
impl Unpin for GamepadMotion
impl UnwindSafe for GamepadMotion
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