Extent

Enum Extent 

Source
pub enum Extent {
    Dims([u32; 3]),
    Ranges(RangeExtent),
}
Expand description

The extent of the structured object being represented in 3D space.

Variants§

§

Dims([u32; 3])

Legacy formats use dimensions to indicate the extent of a grid.

§

Ranges(RangeExtent)

In XML format, inclusive ranges are given as a 6-tuple:

[ x0 x1 y0 y1 z0 z1 ]

where the extent of the grid in say x is given by the inclusive range x0..=x1.

These are translated into Rust’s RangeInclusive for explicitness and convenience as

[ x0..=x1, y0..=y1, z0..=z1 ]

The equivalent extent in legacy format would be Dims([x1-x0+1, y1-y0+1, z1-z0+1]).

Implementations§

Source§

impl Extent

Source

pub fn into_dims(self) -> [u32; 3]

Convert Extent to a triple of dimensions.

If the extent is stored as Extent::Ranges such as

[ x0..=x1, y0..=y1, z0..=z1 ]

then the equivalent extent in legacy format is returned:

[x1-x0+1, y1-y0+1, z1-z0+1]

Source

pub fn into_ranges(self) -> [RangeInclusive<i32>; 3]

Convert Extent to a triplet of ranges.

If the extent is stored as Extent::Dims such as

[ nx, ny, nz ]

then the equivalent extent in XML format is returned:

[0..=nx, 0..=ny, 0..=nz]

Source

pub fn num_points(&self) -> u64

Compute the total number of points represented by this extent.

Source

pub fn num_cells(&self) -> u64

Compute the total number of cells represented by this extent.

Trait Implementations§

Source§

impl Clone for Extent

Source§

fn clone(&self) -> Extent

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 Extent

Source§

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

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

impl Default for Extent

Source§

fn default() -> Extent

The default extent is empty.

Source§

impl From<Extent> for Extent

Source§

fn from(ext: Extent) -> Extent

Converts to this type from the input type.
Source§

impl From<Extent> for Extent

Source§

fn from(ext: Extent) -> Extent

Converts to this type from the input type.
Source§

impl PartialEq for Extent

Source§

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

Auto Trait Implementations§

§

impl Freeze for Extent

§

impl RefUnwindSafe for Extent

§

impl Send for Extent

§

impl Sync for Extent

§

impl Unpin for Extent

§

impl UnwindSafe for Extent

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