[−][src]Struct web_glitz::image::texture_2d_array::LevelSubImageLayers
Reference to the layers of a LevelSubImage.
Methods
impl<'a, F> LevelSubImageLayers<'a, F> where
F: TextureFormat,
[src]
F: TextureFormat,
pub fn len(&self) -> usize
[src]
The number of layers for the LevelSubImage.
pub fn get<'b, I>(&'b self, index: I) -> Option<I::Output> where
I: LevelSubImageLayersIndex<'b, F>,
[src]
I: LevelSubImageLayersIndex<'b, F>,
Returns a reference to the layer at the index
, or None
if the index
is out of bounds.
See also [get_unchecked] for an unsafe variant of this method that does not do any bounds checks.
Example
use web_glitz::image::{MipmapLevels, Region3D}; use web_glitz::image::format::RGB8; use web_glitz::image::texture_2d_array::Texture2DArrayDescriptor; let texture = context.create_texture_2d_array(&Texture2DArrayDescriptor { format: RGB8, width: 256, height: 256, depth: 16, levels: MipmapLevels::Partial(3) }).unwrap(); let base_level = texture.base_level(); let sub_image = base_level.sub_image(Region3D::Area((0, 0, 0), 128, 128, 8)); let layers = sub_image.layers(); assert!(layers.get(1).is_some()); assert!(layers.get(8).is_none());
pub unsafe fn get_unchecked<'b, I>(&'b self, index: I) -> I::Output where
I: LevelSubImageLayersIndex<'b, F>,
[src]
I: LevelSubImageLayersIndex<'b, F>,
Returns a reference to layer at the index
, without doing any bounds checks.
Example
use web_glitz::image::{MipmapLevels, Region3D}; use web_glitz::image::format::RGB8; use web_glitz::image::texture_2d_array::Texture2DArrayDescriptor; let texture = context.create_texture_2d_array(&Texture2DArrayDescriptor { format: RGB8, width: 256, height: 256, depth: 16, levels: MipmapLevels::Partial(3) }).unwrap(); let base_level = texture.base_level(); let sub_image = base_level.sub_image(Region3D::Area((0, 0, 0), 128, 128, 8)); let layers = sub_image.layers(); let layer = unsafe { layers.get_unchecked(1) };
Unsafe
The index
must be in bounds. See also [get] for a safe variant of this method that does
bounds checks.
ⓘImportant traits for LevelSubImageLayersIter<'a, F>pub fn iter(&self) -> LevelSubImageLayersIter<F>
[src]
Returns an iterator over the layers.
Example
use web_glitz::image::{MipmapLevels, Region3D}; use web_glitz::image::format::RGB8; use web_glitz::image::texture_2d_array::Texture2DArrayDescriptor; let texture = context.create_texture_2d_array(&Texture2DArrayDescriptor { format: RGB8, width: 256, height: 256, depth: 16, levels: MipmapLevels::Partial(3) }).unwrap(); let base_level = texture.base_level(); let sub_image = base_level.sub_image(Region3D::Area((0, 0, 0), 128, 128, 3)); let layers = sub_image.layers(); let mut iter = layers.iter(); assert_eq!(iter.next().map(|l| (l.width(), l.height())), Some((128, 128))); assert_eq!(iter.next().map(|l| (l.width(), l.height())), Some((128, 128))); assert_eq!(iter.next().map(|l| (l.width(), l.height())), Some((128, 128))); assert!(iter.next().is_none());
Trait Implementations
impl<'a, F> IntoIterator for LevelSubImageLayers<'a, F> where
F: TextureFormat,
[src]
F: TextureFormat,
type Item = LevelLayerSubImage<'a, F>
The type of the elements being iterated over.
type IntoIter = LevelSubImageLayersIter<'a, F>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
Auto Trait Implementations
impl<'a, F> !Send for LevelSubImageLayers<'a, F>
impl<'a, F> Unpin for LevelSubImageLayers<'a, F>
impl<'a, F> !Sync for LevelSubImageLayers<'a, F>
impl<'a, F> !UnwindSafe for LevelSubImageLayers<'a, F>
impl<'a, F> !RefUnwindSafe for LevelSubImageLayers<'a, F>
Blanket Implementations
impl<D, T> IntoBuffer<T> for D where
D: Borrow<T> + 'static,
T: Copy + 'static,
[src]
D: Borrow<T> + 'static,
T: Copy + 'static,
fn into_buffer<Rc>(Self, &Rc, UsageHint) -> Buffer<T> where
Rc: RenderingContext + Clone + 'static,
[src]
Rc: RenderingContext + Clone + 'static,
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<I> IntoIterator for I where
I: Iterator,
[src]
I: Iterator,
type Item = <I as Iterator>::Item
The type of the elements being iterated over.
type IntoIter = I
Which kind of iterator are we turning this into?
fn into_iter(self) -> I
[src]
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,