Struct glutin::dpi::LogicalPosition
source · pub struct LogicalPosition {
pub x: f64,
pub y: f64,
}
Expand description
A position represented in logical pixels.
The position is stored as floats, so please be careful. Casting floats to integers truncates the fractional part,
which can cause noticable issues. To help with that, an Into<(i32, i32)>
implementation is provided which
does the rounding for you.
Fields§
§x: f64
§y: f64
Implementations§
source§impl LogicalPosition
impl LogicalPosition
pub fn new(x: f64, y: f64) -> LogicalPosition
pub fn from_physical<T>(physical: T, dpi_factor: f64) -> LogicalPositionwhere T: Into<PhysicalPosition>,
pub fn to_physical(&self, dpi_factor: f64) -> PhysicalPosition
Trait Implementations§
source§impl Clone for LogicalPosition
impl Clone for LogicalPosition
source§fn clone(&self) -> LogicalPosition
fn clone(&self) -> LogicalPosition
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 LogicalPosition
impl Debug for LogicalPosition
source§impl<'de> Deserialize<'de> for LogicalPosition
impl<'de> Deserialize<'de> for LogicalPosition
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<LogicalPosition, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>( __deserializer: __D ) -> Result<LogicalPosition, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq<LogicalPosition> for LogicalPosition
impl PartialEq<LogicalPosition> for LogicalPosition
source§fn eq(&self, other: &LogicalPosition) -> bool
fn eq(&self, other: &LogicalPosition) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for LogicalPosition
impl Serialize for LogicalPosition
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where __S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Copy for LogicalPosition
impl StructuralPartialEq for LogicalPosition
Auto Trait Implementations§
impl RefUnwindSafe for LogicalPosition
impl Send for LogicalPosition
impl Sync for LogicalPosition
impl Unpin for LogicalPosition
impl UnwindSafe for LogicalPosition
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