Skip to main content

Coordinates

Struct Coordinates 

Source
pub struct Coordinates {
    pub x: f32,
    pub y: f32,
    pub width: f32,
    pub height: f32,
    pub viewport_width: f32,
    pub viewport_height: f32,
    pub coordinate_space: &'static str,
    pub expected_space: &'static str,
    pub provenance: Provenance,
}
Expand description

UI coordinates with actual and expected coordinate spaces. 同时携带实际坐标系和预期坐标系的 UI 坐标。

Fields§

§x: f32

Logical x of the rectangle’s left edge. 矩形左边缘的逻辑 x 坐标。

§y: f32

Logical y of the rectangle’s top edge. 矩形上边缘的逻辑 y 坐标。

§width: f32

Rectangle width in the actual coordinate space. 实际坐标系下的矩形宽度。

§height: f32

Rectangle height in the actual coordinate space. 实际坐标系下的矩形高度。

§viewport_width: f32

Width of the viewport the rectangle must fit inside. 矩形必须落在其中的视口宽度。

§viewport_height: f32

Height of the viewport the rectangle must fit inside. 矩形必须落在其中的视口高度。

§coordinate_space: &'static str

Coordinate space the rectangle was measured in. 测量该矩形时所用的坐标系。

§expected_space: &'static str

Coordinate space the check requires; must match coordinate_space. 校验要求的坐标系,必须与 coordinate_space 相同。

§provenance: Provenance

Evidence explaining where these coordinates came from. 说明该坐标由来的证据。

Implementations§

Source§

impl Coordinates

Source

pub fn new( x: f32, y: f32, width: f32, height: f32, viewport_width: f32, viewport_height: f32, coordinate_space: &'static str, expected_space: &'static str, provenance: Provenance, ) -> Coordinates

Assemble a coordinate observation for the viewport check to validate. 组装坐标观测,交由视口检查校验。

Trait Implementations§

Source§

impl Clone for Coordinates

Source§

fn clone(&self) -> Coordinates

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Coordinates

Source§

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

Formats the value using the given formatter. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.