Struct sdfer::Image2d

source ·
pub struct Image2d<T, Storage: AsRef<[T]> = Vec<T>> { /* private fields */ }

Implementations§

source§

impl<T, Storage: AsRef<[T]>> Image2d<T, Storage>

source

pub fn new(width: usize, height: usize) -> Self
where T: Default, Storage: FromIterator<T>,

source

pub fn from_fn( width: usize, height: usize, f: impl FnMut(usize, usize) -> T ) -> Self
where Storage: FromIterator<T>,

source

pub fn from_storage(width: usize, height: usize, storage: Storage) -> Self

source

pub fn width(&self) -> usize

source

pub fn height(&self) -> usize

source

pub fn reborrow(&self) -> Image2d<T, &[T]>

source

pub fn reborrow_mut(&mut self) -> Image2d<T, &mut [T]>
where Storage: AsMut<[T]>,

source

pub fn cursor_at(&mut self, x: usize, y: usize) -> Image2dCursor<'_, T>
where Storage: AsMut<[T]>,

Trait Implementations§

source§

impl<T: Clone, Storage: Clone + AsRef<[T]>> Clone for Image2d<T, Storage>

source§

fn clone(&self) -> Image2d<T, Storage>

Returns a copy 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<T: Default, Storage: Default + AsRef<[T]>> Default for Image2d<T, Storage>

source§

fn default() -> Image2d<T, Storage>

Returns the “default value” for a type. Read more
source§

impl<T, Storage: AsRef<[T]>> Index<(usize, usize)> for Image2d<T, Storage>

§

type Output = T

The returned type after indexing.
source§

fn index(&self, (x, y): (usize, usize)) -> &T

Performs the indexing (container[index]) operation. Read more
source§

impl<T, Storage: AsMut<[T]> + AsRef<[T]>> IndexMut<(usize, usize)> for Image2d<T, Storage>

source§

fn index_mut(&mut self, (x, y): (usize, usize)) -> &mut T

Performs the mutable indexing (container[index]) operation. Read more
source§

impl<T: Copy, Storage: Copy + AsRef<[T]>> Copy for Image2d<T, Storage>

Auto Trait Implementations§

§

impl<T, Storage> RefUnwindSafe for Image2d<T, Storage>
where Storage: RefUnwindSafe, T: RefUnwindSafe,

§

impl<T, Storage> Send for Image2d<T, Storage>
where Storage: Send, T: Send,

§

impl<T, Storage> Sync for Image2d<T, Storage>
where Storage: Sync, T: Sync,

§

impl<T, Storage> Unpin for Image2d<T, Storage>
where Storage: Unpin, T: Unpin,

§

impl<T, Storage> UnwindSafe for Image2d<T, Storage>
where Storage: UnwindSafe, T: 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> ToOwned for T
where T: Clone,

§

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

§

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

§

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.