Struct BufferViewSlice

Source
pub struct BufferViewSlice<'a, T>
where T: Content + ?Sized,
{ /* private fields */ }
Expand description

DEPRECATED. Only here for backwards compatibility. Represents a sub-part of a buffer.

Implementations§

Source§

impl<'a, T> BufferSlice<'a, T>
where T: Content + 'a + ?Sized,

Source

pub fn get_size(&self) -> usize

Returns the size in bytes of this slice.

Source

pub fn get_context(&self) -> &Rc<Context>

Returns the context corresponding to this buffer.

Source

pub fn write(&self, data: &T)

Uploads some data in this buffer.

§Implementation
  • For persistent-mapped buffers, waits untils the data is no longer used by the GPU then memcpies the data to the mapping.
  • For immutable buffers, creates a temporary buffer that contains the data then calls glCopyBufferSubData to copy from the temporary buffer to the real one.
  • For other types, calls glBufferSubData.
§Panic

Panics if the length of data is different from the length of this buffer.

Source

pub fn invalidate(&self)

Invalidates the content of the slice. The data becomes undefined.

This operation is a no-op if the backend doesn’t support it and for persistent-mapped buffers.

§Implementation

Calls glInvalidateBufferSubData if supported.

Source

pub fn read(&self) -> Result<T::Owned, ReadError>

Reads the content of the buffer.

Source

pub fn copy_to<S>(&self, target: S) -> Result<(), CopyError>
where S: Into<BufferSlice<'a, T>>,

Copies the content of this slice to another slice.

§Panic

Panics if T is unsized and the other buffer is too small.

Source

pub unsafe fn slice_custom<R>(&self, f: Field<R>) -> BufferSlice<'a, R>
where R: Content,

Builds a slice that contains an element from inside the buffer.

This method builds an object that represents a slice of the buffer. No actual operation OpenGL is performed.

§Example
#[derive(Copy, Clone)]
struct BufferContent {
    value1: u16,
    value2: u16,
}

let slice = unsafe { buffer.slice_custom(glium::field!(BufferContent, value2)) };
Source

pub fn as_slice_any(&self) -> BufferAnySlice<'a>

Builds a slice-any containing the whole subbuffer.

This method builds an object that represents a slice of the buffer. No actual operation OpenGL is performed.

Source§

impl<'a, T> BufferSlice<'a, [T]>
where [T]: Content + 'a,

Source

pub fn len(&self) -> usize

Returns the number of elements in this slice.

Source

pub fn slice<R: RangeArgument<usize>>( &self, range: R, ) -> Option<BufferSlice<'a, [T]>>

Builds a subslice of this slice. Returns None if out of range.

This method builds an object that represents a slice of the buffer. No actual operation OpenGL is performed.

Source§

impl<'a, T> BufferSlice<'a, [T]>
where T: PixelValue + 'a,

Source

pub fn read_as_texture_1d<S>(&self) -> Result<S, ReadError>
where S: Texture1dDataSink<T>,

Reads the content of the buffer.

Trait Implementations§

Source§

impl<'a, T> Clone for BufferSlice<'a, T>
where T: Content + Clone + ?Sized,

Source§

fn clone(&self) -> BufferSlice<'a, T>

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<'a, T> Debug for BufferSlice<'a, T>
where T: Content + ?Sized,

Source§

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

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

impl<'a, T> From<&'a Buffer<T>> for BufferSlice<'a, T>
where T: Content + 'a + ?Sized,

Source§

fn from(b: &'a Buffer<T>) -> BufferSlice<'a, T>

Converts to this type from the input type.
Source§

impl<'a> From<&'a DrawCommandsIndicesBuffer> for BufferSlice<'a, [DrawCommandIndices]>

Source§

fn from( b: &'a DrawCommandsIndicesBuffer, ) -> BufferSlice<'a, [DrawCommandIndices]>

Converts to this type from the input type.
Source§

impl<'a> From<&'a DrawCommandsNoIndicesBuffer> for BufferSlice<'a, [DrawCommandNoIndices]>

Source§

fn from( b: &'a DrawCommandsNoIndicesBuffer, ) -> BufferSlice<'a, [DrawCommandNoIndices]>

Converts to this type from the input type.
Source§

impl<'a, T> From<&'a IndexBuffer<T>> for BufferSlice<'a, [T]>
where T: Index,

Source§

fn from(b: &'a IndexBuffer<T>) -> BufferSlice<'a, [T]>

Converts to this type from the input type.
Source§

impl<'a, T> From<&'a UniformBuffer<T>> for BufferSlice<'a, T>
where T: Content + ?Sized,

Source§

fn from(b: &'a UniformBuffer<T>) -> BufferSlice<'a, T>

Converts to this type from the input type.
Source§

impl<'a, T> From<&'a VertexBuffer<T>> for BufferSlice<'a, [T]>
where T: Copy,

Source§

fn from(b: &'a VertexBuffer<T>) -> BufferSlice<'a, [T]>

Converts to this type from the input type.
Source§

impl<'a, T> From<&'a mut Buffer<T>> for BufferSlice<'a, T>
where T: Content + 'a + ?Sized,

Source§

fn from(b: &'a mut Buffer<T>) -> BufferSlice<'a, T>

Converts to this type from the input type.
Source§

impl<'a, T> From<BufferMutSlice<'a, T>> for BufferSlice<'a, T>
where T: Content + 'a + ?Sized,

Source§

fn from(s: BufferMutSlice<'a, T>) -> BufferSlice<'a, T>

Converts to this type from the input type.
Source§

impl<'a, T> From<IndexBufferSlice<'a, T>> for BufferSlice<'a, [T]>
where T: Index,

Source§

fn from(b: IndexBufferSlice<'a, T>) -> BufferSlice<'a, [T]>

Converts to this type from the input type.
Source§

impl<'a, T> From<VertexBufferSlice<'a, T>> for BufferSlice<'a, [T]>
where T: Copy,

Source§

fn from(b: VertexBufferSlice<'a, T>) -> BufferSlice<'a, [T]>

Converts to this type from the input type.
Source§

impl<'a, T> Copy for BufferSlice<'a, T>
where T: Content + Copy + ?Sized,

Auto Trait Implementations§

§

impl<'a, T> Freeze for BufferSlice<'a, T>
where T: ?Sized,

§

impl<'a, T> !RefUnwindSafe for BufferSlice<'a, T>

§

impl<'a, T> !Send for BufferSlice<'a, T>

§

impl<'a, T> !Sync for BufferSlice<'a, T>

§

impl<'a, T> Unpin for BufferSlice<'a, T>
where T: ?Sized,

§

impl<'a, T> !UnwindSafe for BufferSlice<'a, T>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

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

Source§

type Owned = T

A type that holds a sized version of the content.
Source§

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

Prepares an output buffer, then turns this buffer into an Owned. User-provided closure F must only write to and not read from &mut Self.
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 T>

Builds a pointer to this type from a raw pointer.
Source§

fn is_size_suitable(size: usize) -> bool

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

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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,

Source§

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

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

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more