Struct ps2::MousePacketGeneric
source · pub struct MousePacketGeneric { /* private fields */ }
Implementations§
source§impl MousePacketGeneric
impl MousePacketGeneric
sourcepub const fn into_bytes(self) -> [u8; 3]
pub const fn into_bytes(self) -> [u8; 3]
sourcepub const fn from_bytes(bytes: [u8; 3]) -> Self
pub const fn from_bytes(bytes: [u8; 3]) -> Self
Converts the given bytes directly into the bitfield struct.
source§impl MousePacketGeneric
impl MousePacketGeneric
Returns the value of button_left.
Returns the value of button_left.
#Errors
If the returned value contains an invalid bit pattern for button_left.
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.
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.
Sets the value of button_left to the given value.
#Panics
If the given value is out of bounds for button_left.
Sets the value of button_left to the given value.
#Errors
If the given value is out of bounds for button_left.
Returns the value of button_right.
Returns the value of button_right.
#Errors
If the returned value contains an invalid bit pattern for button_right.
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.
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.
Sets the value of button_right to the given value.
#Panics
If the given value is out of bounds for button_right.
Sets the value of button_right to the given value.
#Errors
If the given value is out of bounds for button_right.
Returns the value of button_middle.
Returns the value of button_middle.
#Errors
If the returned value contains an invalid bit pattern for button_middle.
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.
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.
Sets the value of button_middle to the given value.
#Panics
If the given value is out of bounds for button_middle.
Sets the value of button_middle to the given value.
#Errors
If the given value is out of bounds for button_middle.
sourcepub fn always_one(&self) -> <B1 as Specifier>::InOut
pub fn always_one(&self) -> <B1 as Specifier>::InOut
Returns the value of always_one.
sourcepub fn always_one_or_err(
&self
) -> Result<<B1 as Specifier>::InOut, InvalidBitPattern<<B1 as Specifier>::Bytes>>
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.
sourcepub fn with_always_one(self, new_val: <B1 as Specifier>::InOut) -> Self
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.
sourcepub fn with_always_one_checked(
self,
new_val: <B1 as Specifier>::InOut
) -> Result<Self, OutOfBounds>
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.
sourcepub fn set_always_one(&mut self, new_val: <B1 as Specifier>::InOut)
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.
sourcepub fn set_always_one_checked(
&mut self,
new_val: <B1 as Specifier>::InOut
) -> Result<(), OutOfBounds>
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
impl MousePacketGeneric
sourcepub fn x_movement(&self) -> i16
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
sourcepub fn y_movement(&self) -> i16
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