pub struct Position {
pub x: f64,
pub y: f64,
}Expand description
A position expressed relative to a display rather than in points.
Fields§
§x: f64Horizontal position as a fraction of the display’s width, 0.0..=1.0.
y: f64Vertical position as a fraction of the display’s height, 0.0..=1.0.
Implementations§
Source§impl Position
impl Position
Sourcepub const NAMES: &'static [&'static str]
pub const NAMES: &'static [&'static str]
Every name that parses, for documentation and for tests.
Sourcepub fn parse(raw: &str) -> Result<Self, ValidationError>
pub fn parse(raw: &str) -> Result<Self, ValidationError>
Parse "top-left", "center", "50%,30%" and the rest.
Case and surrounding space are ignored, and both center and centre are
accepted, since a client should not have to guess which spelling the daemon was
written in.
Sourcepub fn resolve(self, logical_size: [f64; 2]) -> LogicalPoint
pub fn resolve(self, logical_size: [f64; 2]) -> LogicalPoint
Turn a fraction of a display into a point on it.
Trait Implementations§
impl Copy for Position
impl StructuralPartialEq for Position
Auto Trait Implementations§
impl Freeze for Position
impl RefUnwindSafe for Position
impl Send for Position
impl Sync for Position
impl Unpin for Position
impl UnsafeUnpin for Position
impl UnwindSafe for Position
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