Struct ps2::MousePacketGeneric

source ·
pub struct MousePacketGeneric { /* private fields */ }

Implementations§

source§

impl MousePacketGeneric

source

pub const fn new() -> Self

Returns an instance with zero initialized data.

source§

impl MousePacketGeneric

source

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

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; 3]) -> Self

Converts the given bytes directly into the bitfield struct.

source§

impl MousePacketGeneric

source

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

Returns the value of button_left.

source

pub fn button_left_or_err( &self ) -> Result<<bool as Specifier>::InOut, InvalidBitPattern<<bool as Specifier>::Bytes>>

Returns the value of button_left.

#Errors

If the returned value contains an invalid bit pattern for button_left.

source

pub fn with_button_left(self, new_val: <bool as Specifier>::InOut) -> Self

Returns a copy of the bitfield with the value of button_left set to the given value.

#Panics

If the given value is out of bounds for button_left.

source

pub fn with_button_left_checked( self, new_val: <bool as Specifier>::InOut ) -> Result<Self, OutOfBounds>

Returns a copy of the bitfield with the value of button_left set to the given value.

#Errors

If the given value is out of bounds for button_left.

source

pub fn set_button_left(&mut self, new_val: <bool as Specifier>::InOut)

Sets the value of button_left to the given value.

#Panics

If the given value is out of bounds for button_left.

source

pub fn set_button_left_checked( &mut self, new_val: <bool as Specifier>::InOut ) -> Result<(), OutOfBounds>

Sets the value of button_left to the given value.

#Errors

If the given value is out of bounds for button_left.

source

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

Returns the value of button_right.

source

pub fn button_right_or_err( &self ) -> Result<<bool as Specifier>::InOut, InvalidBitPattern<<bool as Specifier>::Bytes>>

Returns the value of button_right.

#Errors

If the returned value contains an invalid bit pattern for button_right.

source

pub fn with_button_right(self, new_val: <bool as Specifier>::InOut) -> Self

Returns a copy of the bitfield with the value of button_right set to the given value.

#Panics

If the given value is out of bounds for button_right.

source

pub fn with_button_right_checked( self, new_val: <bool as Specifier>::InOut ) -> Result<Self, OutOfBounds>

Returns a copy of the bitfield with the value of button_right set to the given value.

#Errors

If the given value is out of bounds for button_right.

source

pub fn set_button_right(&mut self, new_val: <bool as Specifier>::InOut)

Sets the value of button_right to the given value.

#Panics

If the given value is out of bounds for button_right.

source

pub fn set_button_right_checked( &mut self, new_val: <bool as Specifier>::InOut ) -> Result<(), OutOfBounds>

Sets the value of button_right to the given value.

#Errors

If the given value is out of bounds for button_right.

source

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

Returns the value of button_middle.

source

pub fn button_middle_or_err( &self ) -> Result<<bool as Specifier>::InOut, InvalidBitPattern<<bool as Specifier>::Bytes>>

Returns the value of button_middle.

#Errors

If the returned value contains an invalid bit pattern for button_middle.

source

pub fn with_button_middle(self, new_val: <bool as Specifier>::InOut) -> Self

Returns a copy of the bitfield with the value of button_middle set to the given value.

#Panics

If the given value is out of bounds for button_middle.

source

pub fn with_button_middle_checked( self, new_val: <bool as Specifier>::InOut ) -> Result<Self, OutOfBounds>

Returns a copy of the bitfield with the value of button_middle set to the given value.

#Errors

If the given value is out of bounds for button_middle.

source

pub fn set_button_middle(&mut self, new_val: <bool as Specifier>::InOut)

Sets the value of button_middle to the given value.

#Panics

If the given value is out of bounds for button_middle.

source

pub fn set_button_middle_checked( &mut self, new_val: <bool as Specifier>::InOut ) -> Result<(), OutOfBounds>

Sets the value of button_middle to the given value.

#Errors

If the given value is out of bounds for button_middle.

source

pub fn always_one(&self) -> <B1 as Specifier>::InOut

Returns the value of always_one.

source

pub fn always_one_or_err( &self ) -> Result<<B1 as Specifier>::InOut, InvalidBitPattern<<B1 as Specifier>::Bytes>>

Returns the value of always_one.

#Errors

If the returned value contains an invalid bit pattern for always_one.

source

pub fn with_always_one(self, new_val: <B1 as Specifier>::InOut) -> Self

Returns a copy of the bitfield with the value of always_one set to the given value.

#Panics

If the given value is out of bounds for always_one.

source

pub fn with_always_one_checked( self, new_val: <B1 as Specifier>::InOut ) -> Result<Self, OutOfBounds>

Returns a copy of the bitfield with the value of always_one set to the given value.

#Errors

If the given value is out of bounds for always_one.

source

pub fn set_always_one(&mut self, new_val: <B1 as Specifier>::InOut)

Sets the value of always_one to the given value.

#Panics

If the given value is out of bounds for always_one.

source

pub fn set_always_one_checked( &mut self, new_val: <B1 as Specifier>::InOut ) -> Result<(), OutOfBounds>

Sets the value of always_one to the given value.

#Errors

If the given value is out of bounds for always_one.

source§

impl MousePacketGeneric

source

pub fn x_movement(&self) -> i16

x_1st_to_8th_bit and x_9th_bit should not be accessed directly, because they’re part of one signed 9-bit number

Note: This handles overflow as well, although it might not happen on newer systems https://forum.osdev.org/viewtopic.php?f=1&t=31176

source

pub fn y_movement(&self) -> i16

y_1st_to_8th_bit and y_9th_bit should not be accessed directly, because they’re part of one signed 9-bit number

Note: This handles overflow as well, although it might not happen on newer systems https://forum.osdev.org/viewtopic.php?f=1&t=31176

Trait Implementations§

source§

impl CheckFillsUnalignedBits for MousePacketGeneric

§

type CheckType = [(); 1]

source§

impl CheckSpecifierHasAtMost128Bits for MousePacketGeneric

§

type CheckType = [(); 1]

source§

impl Debug for MousePacketGeneric

source§

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

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

impl Specifier for MousePacketGeneric

source§

const BITS: usize = 24usize

The amount of bits used by the specifier.
§

type Bytes = <[(); 24] as SpecifierBytes>::Bytes

The base type of the specifier. Read more
§

type InOut = MousePacketGeneric

The interface type of the specifier. Read more
source§

fn into_bytes(value: Self::InOut) -> Result<Self::Bytes, OutOfBounds>

Converts some bytes into the in-out type. Read more
source§

fn from_bytes( bytes: Self::Bytes ) -> Result<Self::InOut, InvalidBitPattern<Self::Bytes>>

Converts the given bytes into the in-out type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.