pub struct IntegerBounds {
    pub position: Vec2<i32>,
    pub size: Vec2<usize>,
}
Expand description

A rectangular section anywhere in 2D integer space. Valid from minimum coordinate (including) -1,073,741,822 to maximum coordinate (including) 1,073,741,822, the value of (i32::MAX/2 -1).

Fields§

§position: Vec2<i32>

The top left corner of this rectangle. The Box2I32 includes this pixel if the size is not zero.

§size: Vec2<usize>

How many pixels to include in this Box2I32. Extends to the right and downwards. Does not include the actual boundary, just like Vec::len().

Implementations§

source§

impl IntegerBounds

source

pub fn zero() -> Self

Create a box with no size located at (0,0).

source

pub fn from_dimensions(size: impl Into<Vec2<usize>>) -> Self

Create a box with a size starting at zero.

source

pub fn new(start: impl Into<Vec2<i32>>, size: impl Into<Vec2<usize>>) -> Self

Create a box with a size and an origin point.

source

pub fn end(self) -> Vec2<i32>

Returns the top-right coordinate of the rectangle. The row and column described by this vector are not included in the rectangle, just like Vec::len().

source

pub fn max(self) -> Vec2<i32>

Returns the maximum coordinate that a value in this rectangle may have.

source

pub fn validate(&self, max_size: Option<Vec2<usize>>) -> UnitResult

Validate this instance.

source

fn validate_min_max_u64(min: Vec2<i64>, max: Vec2<i64>) -> UnitResult

source

pub fn byte_size() -> usize

Number of bytes this would consume in an exr file.

source

pub fn write<W: Write>(&self, write: &mut W) -> UnitResult

Without validation, write this instance to the byte stream.

source

pub fn read<R: Read>(read: &mut R) -> Result<Self>

Read the value without validating.

source

pub fn with_origin(self, origin: Vec2<i32>) -> Self

Create a new rectangle which is offset by the specified origin.

source

pub fn contains(self, subset: Self) -> bool

Returns whether the specified rectangle is equal to or inside this rectangle.

Trait Implementations§

source§

impl Clone for IntegerBounds

source§

fn clone(&self) -> IntegerBounds

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 IntegerBounds

source§

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

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

impl Default for IntegerBounds

source§

fn default() -> IntegerBounds

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

impl Hash for IntegerBounds

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq<IntegerBounds> for IntegerBounds

source§

fn eq(&self, other: &IntegerBounds) -> 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 IntegerBounds

source§

impl Eq for IntegerBounds

source§

impl StructuralEq for IntegerBounds

source§

impl StructuralPartialEq for IntegerBounds

Auto Trait Implementations§

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,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<R, P> ReadPrimitive<R> for Pwhere R: Read + ReadEndian<P>, P: Default,

source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
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, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.