pub struct StrView { /* private fields */ }Implementations§
Source§impl StrView
impl StrView
Sourcepub fn inline(bytes: &[u8]) -> Self
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.
Sourcepub fn long(bytes: &[u8], buffer: u16, offset: u32) -> Self
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.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn is_inline(&self) -> bool
Sourcepub fn inline_bytes(&self) -> &[u8] ⓘ
pub fn inline_bytes(&self) -> &[u8] ⓘ
The bytes of an inline view, read out of the view itself.
Sourcepub fn bytes<'a>(&'a self, bufs: &'a StrBuffers) -> &'a [u8] ⓘ
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.
Sourcepub fn sub(&self, bytes: &[u8], start: usize, len: usize) -> Self
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.
Sourcepub fn eq_with(
&self,
a_bufs: &StrBuffers,
other: &StrView,
b_bufs: &StrBuffers,
) -> bool
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.