CompiledQueryBuffer

Struct CompiledQueryBuffer 

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

Aligned buffer for compiled query data.

Allocated via Layout::from_size_align(len, BUFFER_ALIGN). Standard Box<[u8]> won’t work—it assumes 1-byte alignment and corrupts dealloc.

Implementations§

Source§

impl CompiledQueryBuffer

Source

pub fn allocate(len: usize) -> Self

Allocate a new buffer with 64-byte alignment.

Source

pub unsafe fn from_external(ptr: *mut u8, len: usize) -> Self

Create a view into external memory (mmap’d or borrowed).

§Safety
  • ptr must be valid for reads of len bytes
  • ptr must be aligned to BUFFER_ALIGN
  • The backing memory must outlive the returned buffer
Source

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

Returns a pointer to the buffer start.

Source

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

Returns a mutable pointer to the buffer start.

Source

pub fn len(&self) -> usize

Returns the buffer length in bytes.

Source

pub fn is_empty(&self) -> bool

Returns true if the buffer is empty.

Source

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

Returns the buffer as a byte slice.

Source

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

Returns the buffer as a mutable byte slice.

Trait Implementations§

Source§

impl Drop for CompiledQueryBuffer

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for CompiledQueryBuffer

Source§

impl Sync for CompiledQueryBuffer

Auto Trait Implementations§

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

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, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

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

Performs the conversion.
§

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

§

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

The type returned in the event of a conversion error.
§

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

Performs the conversion.