Skip to main content

BufferImpl

Struct BufferImpl 

Source
pub struct BufferImpl<'a, H: Borrow<A>, A: ?Sized + BufferAllocator> { /* private fields */ }

Implementations§

Source§

impl<'a, H: Borrow<A>, A: ?Sized + BufferAllocator> BufferImpl<'a, H, A>

Source

pub fn as_ref(&self) -> BufferRef<'_>

Takes a read-only reference to this buffer.

Source

pub fn subslice<R: SliceRange>(&self, range: R) -> BufferRef<'_>

Takes a read-only reference to this buffer over range (which must be within the size of the buffer).

Source

pub fn as_mut(&mut self) -> MutableBufferRef<'_>

Takes a read-write reference to this buffer.

Source

pub fn subslice_mut<R: SliceRange>(&mut self, range: R) -> MutableBufferRef<'_>

Takes a read-write reference to this buffer over range (which must be within the size of the buffer).

Source

pub fn len(&self) -> usize

Returns the buffer’s capacity.

Source

pub fn as_slice(&self) -> &[u8]

Returns a slice of the buffer’s contents.

Source

pub fn as_mut_slice(&mut self) -> &mut [u8]

Returns a mutable slice of the buffer’s contents.

Source

pub fn copy_to_slice(&self, dest: &mut [u8])

Copies the contents of this buffer into dest.

§Panics

Panics if dest.len() != self.len().

Source

pub fn copy_from_slice(&mut self, src: &[u8])

Copies the contents of src into this buffer.

§Panics

Panics if src.len() != self.len().

Source

pub fn fill(&mut self, val: u8)

Fills the buffer with val.

Source

pub fn range(&self) -> Range<usize>

Returns the range in the underlying BufferSource that this buffer covers.

Source

pub fn allocator(&self) -> &A

Returns a reference to the allocator.

Source

pub fn to_vec(&self) -> Vec<u8>

Returns the buffer’s contents as a Vec.

Source

pub fn append_to(&self, vec: &mut Vec<u8>)

Appends the buffer’s contents to vec.

Source

pub fn as_ptr(&self) -> *const u8

Returns a raw pointer to the buffer’s contents.

Source

pub fn as_mut_ptr(&mut self) -> *mut u8

Returns a mutable raw pointer to the buffer’s contents.

Source

pub fn as_ptr_slice(&self) -> PtrByteSlice<'_>

Returns a read-only pointer slice over the buffer.

Source

pub fn as_mut_ptr_slice(&mut self) -> MutPtrByteSlice<'_>

Returns a mutable pointer slice over the buffer.

Trait Implementations§

Source§

impl<'a, H: Debug + Borrow<A>, A: Debug + ?Sized + BufferAllocator> Debug for BufferImpl<'a, H, A>

Source§

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

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

impl<'a, H: Borrow<A>, A: ?Sized + BufferAllocator> Drop for BufferImpl<'a, H, A>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<'a, H, A> !UnwindSafe for BufferImpl<'a, H, A>

§

impl<'a, H, A> Freeze for BufferImpl<'a, H, A>
where H: Freeze, A: ?Sized,

§

impl<'a, H, A> RefUnwindSafe for BufferImpl<'a, H, A>
where H: RefUnwindSafe, A: ?Sized,

§

impl<'a, H, A> Send for BufferImpl<'a, H, A>
where H: Send, A: ?Sized,

§

impl<'a, H, A> Sync for BufferImpl<'a, H, A>
where H: Sync, A: ?Sized,

§

impl<'a, H, A> Unpin for BufferImpl<'a, H, A>
where H: Unpin, A: ?Sized,

§

impl<'a, H, A> UnsafeUnpin for BufferImpl<'a, H, A>
where H: UnsafeUnpin, A: ?Sized,

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
§

impl<T, D> Encode<Ambiguous1, D> for T
where D: ResourceDialect,

§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
§

impl<T, D> Encode<Ambiguous2, D> for T
where D: ResourceDialect,

§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. 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.

§

impl<T> Pointable for T

§

const ALIGN: usize

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V