Struct IntegerBounds

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

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

impl IntegerBounds

fn zero() -> Self

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

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

Create a box with a size starting at zero.

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

Create a box with a size and an origin point.

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

fn max(self) -> Vec2<i32>

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

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

Validate this instance.

const fn byte_size() -> usize

Number of bytes this would consume in an exr file.

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

Without validation, write this instance to the byte stream.

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

Read the value without validating.

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

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

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

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

Trait Implementations

impl Clone for IntegerBounds

fn clone(&self) -> Self

impl Copy for IntegerBounds

impl Debug for IntegerBounds

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

impl Default for IntegerBounds

fn default() -> Self

impl Eq for IntegerBounds

impl Hash for IntegerBounds

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

impl PartialEq for IntegerBounds

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

impl StructuralPartialEq for IntegerBounds

Auto Trait Implementations

impl Freeze for IntegerBounds

impl RefUnwindSafe for IntegerBounds

impl Send for IntegerBounds

impl Sync for IntegerBounds

impl Unpin for IntegerBounds

impl UnsafeUnpin for IntegerBounds

impl UnwindSafe for IntegerBounds

Blanket Implementations

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

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for IntegerBounds where ST: ?Sized, DT: ?Sized,

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for IntegerBounds where ST: ?Sized, DT: ?Sized,

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

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for IntegerBounds where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for IntegerBounds where T: ?Sized,

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

impl<T> CloneToUninit for IntegerBounds where T: Clone,

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

impl<T> From<T> for IntegerBounds

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Pointable for IntegerBounds

const ALIGN: usize = _;
type Init = T;
unsafe fn init(init: <T as Pointable>::Init) -> usize
unsafe fn deref<'a>(ptr: usize) -> &'a T
unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
unsafe fn drop(ptr: usize)

impl<T> Read<Exclusive, BecauseExclusive> for IntegerBounds where T: ?Sized,

impl<T> ToOwned for IntegerBounds where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T, U> Into<U> for IntegerBounds where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

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

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for IntegerBounds where U: TryFrom<T>,

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