Struct cuadra::Zone8

source ·
pub struct Zone8 {
    pub p: Position8,
    pub s: Size8,
}
Expand description

A 2D zone combines a Position8 with a Size8.

Fields§

§p: Position8§s: Size8

Implementations§

source§

impl Zone8

source

pub const fn new(position: Position8, size: Size8) -> Self

Returns a new zone from the provided position and size.

source

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

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

source

pub const fn position_size(&self) -> (Position8, Size8)

Gets a tuple with the position and size.

source

pub const fn position(&self) -> Position8

Get the position.

source

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

Chain-set the position.

source

pub const fn size(&self) -> Size8

Get the size.

source

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

Set the size.

source

pub const fn x(&self) -> i8

Get the x position.

source

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

Set the x position.

source

pub const fn y(&self) -> i8

Get the y position.

source

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

Set the y position.

source

pub const fn w(&self) -> i8

Get the width.

source

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

Set the width.

source

pub const fn h(&self) -> i8

Get the height.

source

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

Set the height.

source§

impl Zone8

source

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

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

source

pub const fn from_tuple(tup: (i8, i8, i8, i8)) -> Zone8

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)) -> Zone8

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

Trait Implementations§

source§

impl Clone for Zone8

source§

fn clone(&self) -> Zone8

Returns a copy 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 Zone8

source§

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

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

impl Default for Zone8

source§

fn default() -> Zone8

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

impl Display for Zone8

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 Zone8

source§

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

Converts to this type from the input type.
source§

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

source§

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

Converts to this type from the input type.
source§

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

source§

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

Converts to this type from the input type.
source§

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

source§

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

Converts to this type from the input type.
source§

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

source§

fn from(s: Zone8) -> (i16, i16, i16, i16)

Converts to this type from the input type.
source§

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

source§

fn from(s: Zone8) -> (u16, u16, u16, u16)

Converts to this type from the input type.
source§

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

source§

fn from(s: Zone8) -> (u32, u32, u32, u32)

Converts to this type from the input type.
source§

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

source§

fn from(s: Zone8) -> (usize, usize, usize, usize)

Converts to this type from the input type.
source§

impl PartialEq<Zone8> for Zone8

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for Zone8

source§

impl Eq for Zone8

source§

impl StructuralEq for Zone8

source§

impl StructuralPartialEq for Zone8

Auto Trait Implementations§

§

impl RefUnwindSafe for Zone8

§

impl Send for Zone8

§

impl Sync for Zone8

§

impl Unpin for Zone8

§

impl UnwindSafe for Zone8

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · 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 Twhere T: Clone,

§

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 Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

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

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.