Skip to main content

InMemoryRasterSource

Struct InMemoryRasterSource 

Source
pub struct InMemoryRasterSource { /* private fields */ }
Expand description

In-memory raster source backed by a Vec<f32> for testing and small workloads.

This implementation stores raster data in a flat row-major Vec<f32> and supports efficient sub-window reads with zero-padding for out-of-bounds pixels.

Implementations§

Source§

impl InMemoryRasterSource

Source

pub fn new(data: Vec<f32>, width: usize, height: usize) -> Self

Creates a new in-memory raster source.

§Panics

Panics if data.len() != width * height.

Source

pub fn data(&self) -> &[f32]

Returns a reference to the underlying data slice.

Trait Implementations§

Source§

impl RasterSource for InMemoryRasterSource

Source§

fn width(&self) -> usize

Total width of the raster in pixels.
Source§

fn height(&self) -> usize

Total height of the raster in pixels.
Source§

fn read_window( &self, x: usize, y: usize, w: usize, h: usize, ) -> Result<Vec<f32>, RasterError>

Read a rectangular window of pixels into a Vec<f32>, row-major order. Read more

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