Mapped

Struct Mapped 

Source
pub struct Mapped<T, D: Dimension> { /* private fields */ }

Implementations§

Source§

impl<T, D> Mapped<T, D>
where D: Dimension,

Source

pub fn with_shape<S>(inner: T, shape: S) -> Self
where S: ShapeBuilder<Dim = D>,

Source

pub fn inner(&self) -> &T

Source

pub fn memory_map(&self) -> &[u8]

Source§

impl<T> Mapped<T, Ix1>

Source

pub fn from_vec(inner: T, vec: Vec<u8>) -> Self

Source

pub fn write(&mut self, data: &[u8], offset: usize)

Write new data into the buffer and adjust it’s dirty range accordingly.

This function will panic if the buffer overflows.

Source

pub fn modified_range(&self) -> Option<ModifiedRange<usize>>

Source§

impl Mapped<Buffer, Dim<[usize; 1]>>

Source

pub fn with_buffer( ctx: &mut Context, size: usize, buffer_type: BufferType, usage: Usage, ) -> Result<Self, GraphicsError>

Source

pub fn unmap(&mut self, ctx: &mut Context)

Source§

impl Mapped<Image, Dim<[usize; 2]>>

Source

pub fn new( ctx: &mut Context, texture_type: TextureType, format: PixelFormat, width: u32, height: u32, settings: Settings, ) -> Result<Self, GraphicsError>

Source

pub fn with_data( ctx: &mut Context, texture_type: TextureType, format: PixelFormat, width: u32, height: u32, data: Vec<u8>, settings: Settings, ) -> Result<Self, GraphicsError>

Source

pub fn set_pixels(&mut self, region: Viewport<usize>, data: &[u8])

Source

pub fn get_pixels(&self) -> &[u8]

Source

pub fn get_pixel(&self, x: usize, y: usize) -> &[u8]

Source

pub fn set_pixel(&mut self, x: usize, y: usize, pixel: &[u8])

Source

pub fn pixel_stride(&self) -> usize

Source

pub fn unmap(&mut self, ctx: &mut Context) -> &Image

Trait Implementations§

Source§

impl<T: Debug, D: Debug + Dimension> Debug for Mapped<T, D>

Source§

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

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

impl<T: PartialEq, D: PartialEq + Dimension> PartialEq for Mapped<T, D>

Source§

fn eq(&self, other: &Mapped<T, D>) -> 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<T, D: Dimension> StructuralPartialEq for Mapped<T, D>

Auto Trait Implementations§

§

impl<T, D> Freeze for Mapped<T, D>
where T: Freeze, D: Freeze,

§

impl<T, D> RefUnwindSafe for Mapped<T, D>

§

impl<T, D> Send for Mapped<T, D>
where T: Send,

§

impl<T, D> Sync for Mapped<T, D>
where T: Sync,

§

impl<T, D> Unpin for Mapped<T, D>
where T: Unpin, D: Unpin,

§

impl<T, D> UnwindSafe for Mapped<T, D>
where T: UnwindSafe, D: UnwindSafe,

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