Skip to main content

IntegerBounds

Struct IntegerBounds 

Source
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

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 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 Copy for IntegerBounds

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 Eq for IntegerBounds

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 for IntegerBounds

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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 StructuralPartialEq for IntegerBounds

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

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 P
where 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 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 = 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.