pub struct Buttons { /* private fields */ }
Expand description
A collection of which buttons are pressed
Note: right_trigger
and left_trigger
refer to the buttons (i.e. the click when you hold
them all the way down). For the analog part of the triggers, see
Controller::triggers
.
Implementations§
Source§impl Buttons
impl Buttons
Sourcepub const fn into_bytes(self) -> [u8; 2]
pub const fn into_bytes(self) -> [u8; 2]
Sourcepub const fn from_bytes(bytes: [u8; 2]) -> Self
pub const fn from_bytes(bytes: [u8; 2]) -> Self
Converts the given bytes directly into the bitfield struct.
Source§impl Buttons
impl Buttons
Sourcepub fn a_or_err(
&self,
) -> Result<<bool as Specifier>::InOut, InvalidBitPattern<<bool as Specifier>::Bytes>>
pub fn a_or_err( &self, ) -> Result<<bool as Specifier>::InOut, InvalidBitPattern<<bool as Specifier>::Bytes>>
Returns the value of a.
#Errors
If the returned value contains an invalid bit pattern for a.
Sourcepub fn with_a(self, new_val: <bool as Specifier>::InOut) -> Self
pub fn with_a(self, new_val: <bool as Specifier>::InOut) -> Self
Returns a copy of the bitfield with the value of a set to the given value.
#Panics
If the given value is out of bounds for a.
Sourcepub fn with_a_checked(
self,
new_val: <bool as Specifier>::InOut,
) -> Result<Self, OutOfBounds>
pub fn with_a_checked( self, new_val: <bool as Specifier>::InOut, ) -> Result<Self, OutOfBounds>
Returns a copy of the bitfield with the value of a set to the given value.
#Errors
If the given value is out of bounds for a.
Sourcepub fn set_a(&mut self, new_val: <bool as Specifier>::InOut)
pub fn set_a(&mut self, new_val: <bool as Specifier>::InOut)
Sets the value of a to the given value.
#Panics
If the given value is out of bounds for a.
Sourcepub fn set_a_checked(
&mut self,
new_val: <bool as Specifier>::InOut,
) -> Result<(), OutOfBounds>
pub fn set_a_checked( &mut self, new_val: <bool as Specifier>::InOut, ) -> Result<(), OutOfBounds>
Sets the value of a to the given value.
#Errors
If the given value is out of bounds for a.
Sourcepub fn b_or_err(
&self,
) -> Result<<bool as Specifier>::InOut, InvalidBitPattern<<bool as Specifier>::Bytes>>
pub fn b_or_err( &self, ) -> Result<<bool as Specifier>::InOut, InvalidBitPattern<<bool as Specifier>::Bytes>>
Returns the value of b.
#Errors
If the returned value contains an invalid bit pattern for b.
Sourcepub fn with_b(self, new_val: <bool as Specifier>::InOut) -> Self
pub fn with_b(self, new_val: <bool as Specifier>::InOut) -> Self
Returns a copy of the bitfield with the value of b set to the given value.
#Panics
If the given value is out of bounds for b.
Sourcepub fn with_b_checked(
self,
new_val: <bool as Specifier>::InOut,
) -> Result<Self, OutOfBounds>
pub fn with_b_checked( self, new_val: <bool as Specifier>::InOut, ) -> Result<Self, OutOfBounds>
Returns a copy of the bitfield with the value of b set to the given value.
#Errors
If the given value is out of bounds for b.
Sourcepub fn set_b(&mut self, new_val: <bool as Specifier>::InOut)
pub fn set_b(&mut self, new_val: <bool as Specifier>::InOut)
Sets the value of b to the given value.
#Panics
If the given value is out of bounds for b.
Sourcepub fn set_b_checked(
&mut self,
new_val: <bool as Specifier>::InOut,
) -> Result<(), OutOfBounds>
pub fn set_b_checked( &mut self, new_val: <bool as Specifier>::InOut, ) -> Result<(), OutOfBounds>
Sets the value of b to the given value.
#Errors
If the given value is out of bounds for b.
Sourcepub fn x_or_err(
&self,
) -> Result<<bool as Specifier>::InOut, InvalidBitPattern<<bool as Specifier>::Bytes>>
pub fn x_or_err( &self, ) -> Result<<bool as Specifier>::InOut, InvalidBitPattern<<bool as Specifier>::Bytes>>
Returns the value of x.
#Errors
If the returned value contains an invalid bit pattern for x.
Sourcepub fn with_x(self, new_val: <bool as Specifier>::InOut) -> Self
pub fn with_x(self, new_val: <bool as Specifier>::InOut) -> Self
Returns a copy of the bitfield with the value of x set to the given value.
#Panics
If the given value is out of bounds for x.
Sourcepub fn with_x_checked(
self,
new_val: <bool as Specifier>::InOut,
) -> Result<Self, OutOfBounds>
pub fn with_x_checked( self, new_val: <bool as Specifier>::InOut, ) -> Result<Self, OutOfBounds>
Returns a copy of the bitfield with the value of x set to the given value.
#Errors
If the given value is out of bounds for x.
Sourcepub fn set_x(&mut self, new_val: <bool as Specifier>::InOut)
pub fn set_x(&mut self, new_val: <bool as Specifier>::InOut)
Sets the value of x to the given value.
#Panics
If the given value is out of bounds for x.
Sourcepub fn set_x_checked(
&mut self,
new_val: <bool as Specifier>::InOut,
) -> Result<(), OutOfBounds>
pub fn set_x_checked( &mut self, new_val: <bool as Specifier>::InOut, ) -> Result<(), OutOfBounds>
Sets the value of x to the given value.
#Errors
If the given value is out of bounds for x.
Sourcepub fn y_or_err(
&self,
) -> Result<<bool as Specifier>::InOut, InvalidBitPattern<<bool as Specifier>::Bytes>>
pub fn y_or_err( &self, ) -> Result<<bool as Specifier>::InOut, InvalidBitPattern<<bool as Specifier>::Bytes>>
Returns the value of y.
#Errors
If the returned value contains an invalid bit pattern for y.
Sourcepub fn with_y(self, new_val: <bool as Specifier>::InOut) -> Self
pub fn with_y(self, new_val: <bool as Specifier>::InOut) -> Self
Returns a copy of the bitfield with the value of y set to the given value.
#Panics
If the given value is out of bounds for y.
Sourcepub fn with_y_checked(
self,
new_val: <bool as Specifier>::InOut,
) -> Result<Self, OutOfBounds>
pub fn with_y_checked( self, new_val: <bool as Specifier>::InOut, ) -> Result<Self, OutOfBounds>
Returns a copy of the bitfield with the value of y set to the given value.
#Errors
If the given value is out of bounds for y.
Sourcepub fn set_y(&mut self, new_val: <bool as Specifier>::InOut)
pub fn set_y(&mut self, new_val: <bool as Specifier>::InOut)
Sets the value of y to the given value.
#Panics
If the given value is out of bounds for y.
Sourcepub fn set_y_checked(
&mut self,
new_val: <bool as Specifier>::InOut,
) -> Result<(), OutOfBounds>
pub fn set_y_checked( &mut self, new_val: <bool as Specifier>::InOut, ) -> Result<(), OutOfBounds>
Sets the value of y to the given value.
#Errors
If the given value is out of bounds for y.
Sourcepub fn dpad_left_or_err(
&self,
) -> Result<<bool as Specifier>::InOut, InvalidBitPattern<<bool as Specifier>::Bytes>>
pub fn dpad_left_or_err( &self, ) -> Result<<bool as Specifier>::InOut, InvalidBitPattern<<bool as Specifier>::Bytes>>
Returns the value of dpad_left.
#Errors
If the returned value contains an invalid bit pattern for dpad_left.
Sourcepub fn with_dpad_left(self, new_val: <bool as Specifier>::InOut) -> Self
pub fn with_dpad_left(self, new_val: <bool as Specifier>::InOut) -> Self
Returns a copy of the bitfield with the value of dpad_left set to the given value.
#Panics
If the given value is out of bounds for dpad_left.
Sourcepub fn with_dpad_left_checked(
self,
new_val: <bool as Specifier>::InOut,
) -> Result<Self, OutOfBounds>
pub fn with_dpad_left_checked( self, new_val: <bool as Specifier>::InOut, ) -> Result<Self, OutOfBounds>
Returns a copy of the bitfield with the value of dpad_left set to the given value.
#Errors
If the given value is out of bounds for dpad_left.
Sourcepub fn set_dpad_left(&mut self, new_val: <bool as Specifier>::InOut)
pub fn set_dpad_left(&mut self, new_val: <bool as Specifier>::InOut)
Sets the value of dpad_left to the given value.
#Panics
If the given value is out of bounds for dpad_left.
Sourcepub fn set_dpad_left_checked(
&mut self,
new_val: <bool as Specifier>::InOut,
) -> Result<(), OutOfBounds>
pub fn set_dpad_left_checked( &mut self, new_val: <bool as Specifier>::InOut, ) -> Result<(), OutOfBounds>
Sets the value of dpad_left to the given value.
#Errors
If the given value is out of bounds for dpad_left.
Sourcepub fn dpad_right(&self) -> <bool as Specifier>::InOut
pub fn dpad_right(&self) -> <bool as Specifier>::InOut
Returns the value of dpad_right.
Sourcepub fn dpad_right_or_err(
&self,
) -> Result<<bool as Specifier>::InOut, InvalidBitPattern<<bool as Specifier>::Bytes>>
pub fn dpad_right_or_err( &self, ) -> Result<<bool as Specifier>::InOut, InvalidBitPattern<<bool as Specifier>::Bytes>>
Returns the value of dpad_right.
#Errors
If the returned value contains an invalid bit pattern for dpad_right.
Sourcepub fn with_dpad_right(self, new_val: <bool as Specifier>::InOut) -> Self
pub fn with_dpad_right(self, new_val: <bool as Specifier>::InOut) -> Self
Returns a copy of the bitfield with the value of dpad_right set to the given value.
#Panics
If the given value is out of bounds for dpad_right.
Sourcepub fn with_dpad_right_checked(
self,
new_val: <bool as Specifier>::InOut,
) -> Result<Self, OutOfBounds>
pub fn with_dpad_right_checked( self, new_val: <bool as Specifier>::InOut, ) -> Result<Self, OutOfBounds>
Returns a copy of the bitfield with the value of dpad_right set to the given value.
#Errors
If the given value is out of bounds for dpad_right.
Sourcepub fn set_dpad_right(&mut self, new_val: <bool as Specifier>::InOut)
pub fn set_dpad_right(&mut self, new_val: <bool as Specifier>::InOut)
Sets the value of dpad_right to the given value.
#Panics
If the given value is out of bounds for dpad_right.
Sourcepub fn set_dpad_right_checked(
&mut self,
new_val: <bool as Specifier>::InOut,
) -> Result<(), OutOfBounds>
pub fn set_dpad_right_checked( &mut self, new_val: <bool as Specifier>::InOut, ) -> Result<(), OutOfBounds>
Sets the value of dpad_right to the given value.
#Errors
If the given value is out of bounds for dpad_right.
Sourcepub fn dpad_down_or_err(
&self,
) -> Result<<bool as Specifier>::InOut, InvalidBitPattern<<bool as Specifier>::Bytes>>
pub fn dpad_down_or_err( &self, ) -> Result<<bool as Specifier>::InOut, InvalidBitPattern<<bool as Specifier>::Bytes>>
Returns the value of dpad_down.
#Errors
If the returned value contains an invalid bit pattern for dpad_down.
Sourcepub fn with_dpad_down(self, new_val: <bool as Specifier>::InOut) -> Self
pub fn with_dpad_down(self, new_val: <bool as Specifier>::InOut) -> Self
Returns a copy of the bitfield with the value of dpad_down set to the given value.
#Panics
If the given value is out of bounds for dpad_down.
Sourcepub fn with_dpad_down_checked(
self,
new_val: <bool as Specifier>::InOut,
) -> Result<Self, OutOfBounds>
pub fn with_dpad_down_checked( self, new_val: <bool as Specifier>::InOut, ) -> Result<Self, OutOfBounds>
Returns a copy of the bitfield with the value of dpad_down set to the given value.
#Errors
If the given value is out of bounds for dpad_down.
Sourcepub fn set_dpad_down(&mut self, new_val: <bool as Specifier>::InOut)
pub fn set_dpad_down(&mut self, new_val: <bool as Specifier>::InOut)
Sets the value of dpad_down to the given value.
#Panics
If the given value is out of bounds for dpad_down.
Sourcepub fn set_dpad_down_checked(
&mut self,
new_val: <bool as Specifier>::InOut,
) -> Result<(), OutOfBounds>
pub fn set_dpad_down_checked( &mut self, new_val: <bool as Specifier>::InOut, ) -> Result<(), OutOfBounds>
Sets the value of dpad_down to the given value.
#Errors
If the given value is out of bounds for dpad_down.
Sourcepub fn dpad_up_or_err(
&self,
) -> Result<<bool as Specifier>::InOut, InvalidBitPattern<<bool as Specifier>::Bytes>>
pub fn dpad_up_or_err( &self, ) -> Result<<bool as Specifier>::InOut, InvalidBitPattern<<bool as Specifier>::Bytes>>
Returns the value of dpad_up.
#Errors
If the returned value contains an invalid bit pattern for dpad_up.
Sourcepub fn with_dpad_up(self, new_val: <bool as Specifier>::InOut) -> Self
pub fn with_dpad_up(self, new_val: <bool as Specifier>::InOut) -> Self
Returns a copy of the bitfield with the value of dpad_up set to the given value.
#Panics
If the given value is out of bounds for dpad_up.
Sourcepub fn with_dpad_up_checked(
self,
new_val: <bool as Specifier>::InOut,
) -> Result<Self, OutOfBounds>
pub fn with_dpad_up_checked( self, new_val: <bool as Specifier>::InOut, ) -> Result<Self, OutOfBounds>
Returns a copy of the bitfield with the value of dpad_up set to the given value.
#Errors
If the given value is out of bounds for dpad_up.
Sourcepub fn set_dpad_up(&mut self, new_val: <bool as Specifier>::InOut)
pub fn set_dpad_up(&mut self, new_val: <bool as Specifier>::InOut)
Sets the value of dpad_up to the given value.
#Panics
If the given value is out of bounds for dpad_up.
Sourcepub fn set_dpad_up_checked(
&mut self,
new_val: <bool as Specifier>::InOut,
) -> Result<(), OutOfBounds>
pub fn set_dpad_up_checked( &mut self, new_val: <bool as Specifier>::InOut, ) -> Result<(), OutOfBounds>
Sets the value of dpad_up to the given value.
#Errors
If the given value is out of bounds for dpad_up.
Sourcepub fn start_or_err(
&self,
) -> Result<<bool as Specifier>::InOut, InvalidBitPattern<<bool as Specifier>::Bytes>>
pub fn start_or_err( &self, ) -> Result<<bool as Specifier>::InOut, InvalidBitPattern<<bool as Specifier>::Bytes>>
Returns the value of start.
#Errors
If the returned value contains an invalid bit pattern for start.
Sourcepub fn with_start(self, new_val: <bool as Specifier>::InOut) -> Self
pub fn with_start(self, new_val: <bool as Specifier>::InOut) -> Self
Returns a copy of the bitfield with the value of start set to the given value.
#Panics
If the given value is out of bounds for start.
Sourcepub fn with_start_checked(
self,
new_val: <bool as Specifier>::InOut,
) -> Result<Self, OutOfBounds>
pub fn with_start_checked( self, new_val: <bool as Specifier>::InOut, ) -> Result<Self, OutOfBounds>
Returns a copy of the bitfield with the value of start set to the given value.
#Errors
If the given value is out of bounds for start.
Sourcepub fn set_start(&mut self, new_val: <bool as Specifier>::InOut)
pub fn set_start(&mut self, new_val: <bool as Specifier>::InOut)
Sets the value of start to the given value.
#Panics
If the given value is out of bounds for start.
Sourcepub fn set_start_checked(
&mut self,
new_val: <bool as Specifier>::InOut,
) -> Result<(), OutOfBounds>
pub fn set_start_checked( &mut self, new_val: <bool as Specifier>::InOut, ) -> Result<(), OutOfBounds>
Sets the value of start to the given value.
#Errors
If the given value is out of bounds for start.
Sourcepub fn z_or_err(
&self,
) -> Result<<bool as Specifier>::InOut, InvalidBitPattern<<bool as Specifier>::Bytes>>
pub fn z_or_err( &self, ) -> Result<<bool as Specifier>::InOut, InvalidBitPattern<<bool as Specifier>::Bytes>>
Returns the value of z.
#Errors
If the returned value contains an invalid bit pattern for z.
Sourcepub fn with_z(self, new_val: <bool as Specifier>::InOut) -> Self
pub fn with_z(self, new_val: <bool as Specifier>::InOut) -> Self
Returns a copy of the bitfield with the value of z set to the given value.
#Panics
If the given value is out of bounds for z.
Sourcepub fn with_z_checked(
self,
new_val: <bool as Specifier>::InOut,
) -> Result<Self, OutOfBounds>
pub fn with_z_checked( self, new_val: <bool as Specifier>::InOut, ) -> Result<Self, OutOfBounds>
Returns a copy of the bitfield with the value of z set to the given value.
#Errors
If the given value is out of bounds for z.
Sourcepub fn set_z(&mut self, new_val: <bool as Specifier>::InOut)
pub fn set_z(&mut self, new_val: <bool as Specifier>::InOut)
Sets the value of z to the given value.
#Panics
If the given value is out of bounds for z.
Sourcepub fn set_z_checked(
&mut self,
new_val: <bool as Specifier>::InOut,
) -> Result<(), OutOfBounds>
pub fn set_z_checked( &mut self, new_val: <bool as Specifier>::InOut, ) -> Result<(), OutOfBounds>
Sets the value of z to the given value.
#Errors
If the given value is out of bounds for z.
Sourcepub fn right_trigger(&self) -> <bool as Specifier>::InOut
pub fn right_trigger(&self) -> <bool as Specifier>::InOut
Returns the value of right_trigger.
Sourcepub fn right_trigger_or_err(
&self,
) -> Result<<bool as Specifier>::InOut, InvalidBitPattern<<bool as Specifier>::Bytes>>
pub fn right_trigger_or_err( &self, ) -> Result<<bool as Specifier>::InOut, InvalidBitPattern<<bool as Specifier>::Bytes>>
Returns the value of right_trigger.
#Errors
If the returned value contains an invalid bit pattern for right_trigger.
Sourcepub fn with_right_trigger(self, new_val: <bool as Specifier>::InOut) -> Self
pub fn with_right_trigger(self, new_val: <bool as Specifier>::InOut) -> Self
Returns a copy of the bitfield with the value of right_trigger set to the given value.
#Panics
If the given value is out of bounds for right_trigger.
Sourcepub fn with_right_trigger_checked(
self,
new_val: <bool as Specifier>::InOut,
) -> Result<Self, OutOfBounds>
pub fn with_right_trigger_checked( self, new_val: <bool as Specifier>::InOut, ) -> Result<Self, OutOfBounds>
Returns a copy of the bitfield with the value of right_trigger set to the given value.
#Errors
If the given value is out of bounds for right_trigger.
Sourcepub fn set_right_trigger(&mut self, new_val: <bool as Specifier>::InOut)
pub fn set_right_trigger(&mut self, new_val: <bool as Specifier>::InOut)
Sets the value of right_trigger to the given value.
#Panics
If the given value is out of bounds for right_trigger.
Sourcepub fn set_right_trigger_checked(
&mut self,
new_val: <bool as Specifier>::InOut,
) -> Result<(), OutOfBounds>
pub fn set_right_trigger_checked( &mut self, new_val: <bool as Specifier>::InOut, ) -> Result<(), OutOfBounds>
Sets the value of right_trigger to the given value.
#Errors
If the given value is out of bounds for right_trigger.
Sourcepub fn left_trigger(&self) -> <bool as Specifier>::InOut
pub fn left_trigger(&self) -> <bool as Specifier>::InOut
Returns the value of left_trigger.
Sourcepub fn left_trigger_or_err(
&self,
) -> Result<<bool as Specifier>::InOut, InvalidBitPattern<<bool as Specifier>::Bytes>>
pub fn left_trigger_or_err( &self, ) -> Result<<bool as Specifier>::InOut, InvalidBitPattern<<bool as Specifier>::Bytes>>
Returns the value of left_trigger.
#Errors
If the returned value contains an invalid bit pattern for left_trigger.
Sourcepub fn with_left_trigger(self, new_val: <bool as Specifier>::InOut) -> Self
pub fn with_left_trigger(self, new_val: <bool as Specifier>::InOut) -> Self
Returns a copy of the bitfield with the value of left_trigger set to the given value.
#Panics
If the given value is out of bounds for left_trigger.
Sourcepub fn with_left_trigger_checked(
self,
new_val: <bool as Specifier>::InOut,
) -> Result<Self, OutOfBounds>
pub fn with_left_trigger_checked( self, new_val: <bool as Specifier>::InOut, ) -> Result<Self, OutOfBounds>
Returns a copy of the bitfield with the value of left_trigger set to the given value.
#Errors
If the given value is out of bounds for left_trigger.
Sourcepub fn set_left_trigger(&mut self, new_val: <bool as Specifier>::InOut)
pub fn set_left_trigger(&mut self, new_val: <bool as Specifier>::InOut)
Sets the value of left_trigger to the given value.
#Panics
If the given value is out of bounds for left_trigger.
Sourcepub fn set_left_trigger_checked(
&mut self,
new_val: <bool as Specifier>::InOut,
) -> Result<(), OutOfBounds>
pub fn set_left_trigger_checked( &mut self, new_val: <bool as Specifier>::InOut, ) -> Result<(), OutOfBounds>
Sets the value of left_trigger to the given value.
#Errors
If the given value is out of bounds for left_trigger.
Sourcepub fn padding_or_err(
&self,
) -> Result<<B4 as Specifier>::InOut, InvalidBitPattern<<B4 as Specifier>::Bytes>>
pub fn padding_or_err( &self, ) -> Result<<B4 as Specifier>::InOut, InvalidBitPattern<<B4 as Specifier>::Bytes>>
Returns the value of padding.
#Errors
If the returned value contains an invalid bit pattern for padding.
Sourcepub fn with_padding(self, new_val: <B4 as Specifier>::InOut) -> Self
pub fn with_padding(self, new_val: <B4 as Specifier>::InOut) -> Self
Returns a copy of the bitfield with the value of padding set to the given value.
#Panics
If the given value is out of bounds for padding.
Sourcepub fn with_padding_checked(
self,
new_val: <B4 as Specifier>::InOut,
) -> Result<Self, OutOfBounds>
pub fn with_padding_checked( self, new_val: <B4 as Specifier>::InOut, ) -> Result<Self, OutOfBounds>
Returns a copy of the bitfield with the value of padding set to the given value.
#Errors
If the given value is out of bounds for padding.
Sourcepub fn set_padding(&mut self, new_val: <B4 as Specifier>::InOut)
pub fn set_padding(&mut self, new_val: <B4 as Specifier>::InOut)
Sets the value of padding to the given value.
#Panics
If the given value is out of bounds for padding.
Sourcepub fn set_padding_checked(
&mut self,
new_val: <B4 as Specifier>::InOut,
) -> Result<(), OutOfBounds>
pub fn set_padding_checked( &mut self, new_val: <B4 as Specifier>::InOut, ) -> Result<(), OutOfBounds>
Sets the value of padding to the given value.
#Errors
If the given value is out of bounds for padding.