Zone16

Struct Zone16 

Source
pub struct Zone16 {
    pub p: Position16,
    pub s: Size16,
}
Expand description

A 2D zone combines a Position16 with a Size16.

Fields§

§p: Position16§s: Size16

Implementations§

Source§

impl Zone16

Source

pub const fn new(position: Position16, size: Size16) -> Self

Returns a new zone from the provided position and size.

Source

pub const fn new_raw(x: i16, y: i16, width: i16, height: i16) -> Self

Returns a new zone from the provided position and size raw components.

Source

pub const fn position_size(&self) -> (Position16, Size16)

Gets a tuple with the position and size.

Source

pub const fn position(&self) -> Position16

Get the position.

Source

pub fn set_position(self, position: impl Into<Position16>)

Chain-set the position.

Source

pub const fn size(&self) -> Size16

Get the size.

Source

pub fn set_size(self, size: impl Into<Size16>)

Set the size.

Source

pub const fn x(&self) -> i16

Get the x position.

Source

pub fn set_x(&mut self, x: i16)

Set the x position.

Source

pub const fn y(&self) -> i16

Get the y position.

Source

pub fn set_y(&mut self, y: i16)

Set the y position.

Source

pub const fn w(&self) -> i16

Get the width.

Source

pub fn set_w(&mut self, width: i16)

Set the width.

Source

pub const fn h(&self) -> i16

Get the height.

Source

pub fn set_h(&mut self, height: i16)

Set the height.

Source§

impl Zone16

§conversions

Source

pub const fn as_tuple(&self) -> (i16, i16, i16, i16)

Returns a tuple with the (x, y, width, height) components.

Source

pub const fn from_tuple(tup: (i16, i16, i16, i16)) -> Zone16

Creates a zone from a tuple with (x, y, width, height) components.

Source

pub const fn as_tuple_i32(&self) -> (i32, i32, i32, i32)

Source

pub const fn from_tuple_i32(tup: (i32, i32, i32, i32)) -> Zone16

Source

pub const fn as_tuple_u32(&self) -> (u32, u32, u32, u32)

Source

pub const fn from_tuple_u32(tup: (u32, u32, u32, u32)) -> Zone16

Source

pub const fn as_tuple_u16(&self) -> (u16, u16, u16, u16)

Source

pub const fn from_tuple_u16(tup: (u16, u16, u16, u16)) -> Zone16

Source

pub const fn as_tuple_i16(&self) -> (i16, i16, i16, i16)

Source

pub const fn from_tuple_i16(tup: (i16, i16, i16, i16)) -> Zone16

Source

pub const fn as_tuple_usize(&self) -> (usize, usize, usize, usize)

Source

pub const fn from_tuple_usize(tup: (usize, usize, usize, usize)) -> Zone16

Trait Implementations§

Source§

impl Clone for Zone16

Source§

fn clone(&self) -> Zone16

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Zone16

Source§

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

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

impl Default for Zone16

Source§

fn default() -> Zone16

Returns the “default value” for a type. Read more
Source§

impl Display for Zone16

Source§

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

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

impl From<(i16, i16, i16, i16)> for Zone16

Source§

fn from(tup: (i16, i16, i16, i16)) -> Zone16

Converts to this type from the input type.
Source§

impl From<(i32, i32, i32, i32)> for Zone16

Source§

fn from(tup: (i32, i32, i32, i32)) -> Zone16

Converts to this type from the input type.
Source§

impl From<(u16, u16, u16, u16)> for Zone16

Source§

fn from(tup: (u16, u16, u16, u16)) -> Zone16

Converts to this type from the input type.
Source§

impl From<(u32, u32, u32, u32)> for Zone16

Source§

fn from(tup: (u32, u32, u32, u32)) -> Zone16

Converts to this type from the input type.
Source§

impl From<(usize, usize, usize, usize)> for Zone16

Source§

fn from(tup: (usize, usize, usize, usize)) -> Zone16

Converts to this type from the input type.
Source§

impl From<Zone16> for (i16, i16, i16, i16)

Source§

fn from(z: Zone16) -> (i16, i16, i16, i16)

Converts to this type from the input type.
Source§

impl From<Zone16> for (i32, i32, i32, i32)

Source§

fn from(z: Zone16) -> (i32, i32, i32, i32)

Converts to this type from the input type.
Source§

impl From<Zone16> for (u16, u16, u16, u16)

Source§

fn from(z: Zone16) -> (u16, u16, u16, u16)

Converts to this type from the input type.
Source§

impl From<Zone16> for (u32, u32, u32, u32)

Source§

fn from(z: Zone16) -> (u32, u32, u32, u32)

Converts to this type from the input type.
Source§

impl From<Zone16> for (usize, usize, usize, usize)

Source§

fn from(z: Zone16) -> (usize, usize, usize, usize)

Converts to this type from the input type.
Source§

impl PartialEq for Zone16

Source§

fn eq(&self, other: &Zone16) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for Zone16

Source§

impl Eq for Zone16

Source§

impl StructuralPartialEq for Zone16

Auto Trait Implementations§

§

impl Freeze for Zone16

§

impl RefUnwindSafe for Zone16

§

impl Send for Zone16

§

impl Sync for Zone16

§

impl Unpin for Zone16

§

impl UnwindSafe for Zone16

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

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 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.