Struct Buttons

Source
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

Source

pub const fn new() -> Self

Returns an instance with zero initialized data.

Source§

impl Buttons

Source

pub const fn into_bytes(self) -> [u8; 2]

Returns the underlying bits.

§Layout

The returned byte array is layed out in the same way as described here.

Source

pub const fn from_bytes(bytes: [u8; 2]) -> Self

Converts the given bytes directly into the bitfield struct.

Source§

impl Buttons

Source

pub fn a(&self) -> <bool as Specifier>::InOut

Returns the value of a.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn b(&self) -> <bool as Specifier>::InOut

Returns the value of b.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn x(&self) -> <bool as Specifier>::InOut

Returns the value of x.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn y(&self) -> <bool as Specifier>::InOut

Returns the value of y.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn dpad_left(&self) -> <bool as Specifier>::InOut

Returns the value of dpad_left.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn dpad_right(&self) -> <bool as Specifier>::InOut

Returns the value of dpad_right.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn dpad_down(&self) -> <bool as Specifier>::InOut

Returns the value of dpad_down.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn dpad_up(&self) -> <bool as Specifier>::InOut

Returns the value of dpad_up.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn start(&self) -> <bool as Specifier>::InOut

Returns the value of start.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn z(&self) -> <bool as Specifier>::InOut

Returns the value of z.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn right_trigger(&self) -> <bool as Specifier>::InOut

Returns the value of right_trigger.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn left_trigger(&self) -> <bool as Specifier>::InOut

Returns the value of left_trigger.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn padding(&self) -> <B4 as Specifier>::InOut

Returns the value of padding.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl BinRead for Buttons

Source§

type Args = ()

The type of arguments needed to be supplied in order to read this type, usually a tuple. Read more
Source§

fn read_options<R: Read + Seek>( __binread_generated_var_reader: &mut R, __binread_generated_var_options: &ReadOptions, __binread_generated_var_arguments: Self::Args, ) -> BinResult<Self>

Read the type from the reader
Source§

fn after_parse<R: Read + Seek>( &mut self, __binread_generated_var_reader: &mut R, __binread_generated_var_options: &ReadOptions, __binread_generated_var_arguments: Self::Args, ) -> BinResult<()>

Source§

fn read<R>(reader: &mut R) -> Result<Self, Error>
where R: Read + Seek,

Read the type from the reader while assuming no arguments have been passed Read more
Source§

fn read_args<R>(reader: &mut R, args: Self::Args) -> Result<Self, Error>
where R: Read + Seek,

Read the type from the reader using the specified arguments
Source§

fn args_default() -> Option<Self::Args>

The default arguments to be used when using the read shortcut method. Override this for any type that optionally requries arguments
Source§

impl CheckTotalSizeMultipleOf8 for Buttons

Source§

type Size = TotalSize<[(); 0]>

Source§

impl Debug for Buttons

Source§

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

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

impl Default for Buttons

Source§

fn default() -> Buttons

Returns the “default value” for a type. Read more

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> 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, 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.