Trait glium::buffer::Content

source ·
pub unsafe trait Content {
    type Owned;

    // Required methods
    fn read<F, E>(size: usize, _: F) -> Result<Self::Owned, E>
       where F: FnOnce(&mut Self) -> Result<(), E>;
    fn get_elements_size() -> usize;
    fn to_void_ptr(&self) -> *const ();
    fn ref_from_ptr<'a>(ptr: *mut (), size: usize) -> Option<*mut Self>;
    fn is_size_suitable(_: usize) -> bool;
}
Expand description

Trait for types of data that can be put inside buffers.

Required Associated Types§

source

type Owned

A type that holds a sized version of the content.

Required Methods§

source

fn read<F, E>(size: usize, _: F) -> Result<Self::Owned, E>where F: FnOnce(&mut Self) -> Result<(), E>,

Prepares an output buffer, then turns this buffer into an Owned.

source

fn get_elements_size() -> usize

Returns the size of each element.

source

fn to_void_ptr(&self) -> *const ()

Produces a pointer to the data.

source

fn ref_from_ptr<'a>(ptr: *mut (), size: usize) -> Option<*mut Self>

Builds a pointer to this type from a raw pointer.

source

fn is_size_suitable(_: usize) -> bool

Returns true if the size is suitable to store a type like this.

Implementations on Foreign Types§

source§

impl<T> Content for [T]where T: Copy,

§

type Owned = Vec<T, Global>

source§

fn read<F, E>(size: usize, f: F) -> Result<Vec<T>, E>where F: FnOnce(&mut [T]) -> Result<(), E>,

source§

fn get_elements_size() -> usize

source§

fn to_void_ptr(&self) -> *const ()

source§

fn ref_from_ptr<'a>(ptr: *mut (), size: usize) -> Option<*mut [T]>

source§

fn is_size_suitable(size: usize) -> bool

Implementors§

source§

impl<T> Content for Twhere T: Copy,

§

type Owned = T