Skip to main content

StrView

Struct StrView 

Source
pub struct StrView { /* private fields */ }

Implementations§

Source§

impl StrView

Source

pub fn inline(bytes: &[u8]) -> Self

Build a view over a short string, bytes stored inline.

The payload arrives as two words rather than as two copies of a run time length, because a copy of a run time length is a memcpy call and this runs once per row of every string column the engine reads.

Source

pub fn long(bytes: &[u8], buffer: u16, offset: u32) -> Self

Build a view over a long string living in StrBuffers buffer buffer at offset. The caller passes the full bytes so the prefix can be captured.

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn is_inline(&self) -> bool

Source

pub fn inline_bytes(&self) -> &[u8] ⓘ

The bytes of an inline view, read out of the view itself.

Source

pub fn bytes<'a>(&'a self, bufs: &'a StrBuffers) -> &'a [u8] ⓘ

The string bytes. Inline views read out of the view itself; long views resolve through the shared buffers.

Source

pub fn sub(&self, bytes: &[u8], start: usize, len: usize) -> Self

A view over len bytes of this string starting at start, where bytes is what Self::bytes answered for it.

A part of a string is bytes that are already somewhere, so this makes no bytes and copies none: a part short enough goes inline and a longer one names the buffer and offset this view names, moved along by where the part begins. That is what a trim wants, since what a trim answers is always a part of what it was handed, and it is why a chunk of trimmed strings can cost no bytes at all beyond the views themselves.

A part longer than the inline limit can only have come from a view that was already long, so the buffer it names is there to name.

Source

pub fn eq_with( &self, a_bufs: &StrBuffers, other: &StrView, b_bufs: &StrBuffers, ) -> bool

Equality without materializing either side. The length and prefix word reject most non-equal pairs before any buffer is touched.

Trait Implementations§

Source§

impl Clone for StrView

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for StrView

Source§

impl Pod for StrView

Auto Trait Implementations§

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

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.