Struct image2::Mmap

source ·
pub struct Mmap<T: Type> { /* private fields */ }
Expand description

Memory-mapped image data

Implementations§

source§

impl<T: Type> Mmap<T>

source

pub fn write_header<C: Color>( file: impl Write, meta: &Meta<T, C> ) -> Result<(), Error>

Write header to file

source

pub fn create<C: Color>( filename: impl AsRef<Path>, meta: &Meta<T, C> ) -> Result<Self, Error>

Create new Mmap on disk

source

pub fn create_image<C: Color>( filename: impl AsRef<Path>, meta: &Meta<T, C> ) -> Result<Image<T, C>, Error>

Create new image on disk

source

pub fn read_header<C: Color>(file: impl Read) -> Result<Meta<T, C>, Error>

Read header from file on disk

source

pub fn load<C: Color>( filename: impl AsRef<Path> ) -> Result<(Mmap<T>, Meta<T, C>), Error>

Load Mmap from disk

source

pub fn load_image<C: Color>( filename: impl AsRef<Path> ) -> Result<Image<T, C>, Error>

Load image from disk

Trait Implementations§

source§

impl<T: Type> AsMut<[T]> for Mmap<T>

source§

fn as_mut(&mut self) -> &mut [T]

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl<T: Type> AsRef<[T]> for Mmap<T>

source§

fn as_ref(&self) -> &[T]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<T: Type> Drop for Mmap<T>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<T: Type> ImageData<T> for Mmap<T>

source§

fn flush(&self) -> Result<(), Error>

Flush image data to disk, this is a no-op except when using memory-mapped data
source§

fn data(&self) -> &[T]

Get slice
source§

fn data_mut(&mut self) -> &mut [T]

Get mutable slice
source§

fn as_ptr(&self) -> *const T

Get pointer
source§

fn as_mut_ptr(&mut self) -> *mut T

Get mutable pointer
source§

fn buffer(&self) -> &[u8]

Get byte slice
source§

fn buffer_mut(&mut self) -> &mut [u8]

Get mutable byte slice

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for Mmap<T>where T: RefUnwindSafe,

§

impl<T> Send for Mmap<T>

§

impl<T> Sync for Mmap<T>

§

impl<T> Unpin for Mmap<T>

§

impl<T> UnwindSafe for Mmap<T>where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.