pub struct Strings<BC = Vec<u64>, VC = Vec<u8>> {
pub bounds: BC,
pub values: VC,
}Expand description
A stand-in for Vec<String>.
The reference type for Strings is &[u8] rather than &str to remove utf8 validation
from the critical path of reads. You get to make the call about whether and how you’d like
to manage this validation. The copy_from and into_owned methods panic on invalid data.
Fields§
§bounds: BCBounds container; provides indexed access to offsets.
values: VCValues container; provides slice access to bytes.
Implementations§
Source§impl<'a, BC: Len + IndexAs<u64>> Strings<BC, &'a [u8]>
impl<'a, BC: Len + IndexAs<u64>> Strings<BC, &'a [u8]>
Sourcepub fn get_str(&self, index: usize) -> &'a str
pub fn get_str(&self, index: usize) -> &'a str
Returns the index-th string as &str, validating UTF-8.
This is a convenience wrapper around Index::get (which returns &[u8])
for callers who need &str. The UTF-8 validation has a measurable cost;
use get directly if you can work with &[u8].
Trait Implementations§
Source§impl<BC: BorrowIndexAs<u64>> Borrow for Strings<BC, Vec<u8>>
impl<BC: BorrowIndexAs<u64>> Borrow for Strings<BC, Vec<u8>>
Source§type Borrowed<'a> = Strings<<BC as Borrow>::Borrowed<'a>, &'a [u8]>
where
BC: 'a
type Borrowed<'a> = Strings<<BC as Borrow>::Borrowed<'a>, &'a [u8]> where BC: 'a
The type of a borrowed container. Read more
Source§fn borrow<'a>(&'a self) -> Self::Borrowed<'a>
fn borrow<'a>(&'a self) -> Self::Borrowed<'a>
Converts a reference to the type to a borrowed variant. Read more
Source§fn reborrow<'c, 'a: 'c>(thing: Self::Borrowed<'a>) -> Self::Borrowed<'c>where
BC: 'a,
fn reborrow<'c, 'a: 'c>(thing: Self::Borrowed<'a>) -> Self::Borrowed<'c>where
BC: 'a,
Reborrows the borrowed type to a shorter lifetime. See
Columnar::reborrow for details.Source§fn reborrow_ref<'b, 'a: 'b>(thing: Self::Ref<'a>) -> Self::Ref<'b>where
Self: 'a,
fn reborrow_ref<'b, 'a: 'b>(thing: Self::Ref<'a>) -> Self::Ref<'b>where
Self: 'a,
Reborrows the borrowed type to a shorter lifetime. See
Columnar::reborrow for details.Source§impl<BC: PushIndexAs<u64>> Container for Strings<BC, Vec<u8>>
impl<BC: PushIndexAs<u64>> Container for Strings<BC, Vec<u8>>
fn reserve_for<'a, I>(&mut self, selves: I)
Source§impl<'a, BC: FromBytes<'a>, VC: FromBytes<'a>> FromBytes<'a> for Strings<BC, VC>
impl<'a, BC: FromBytes<'a>, VC: FromBytes<'a>> FromBytes<'a> for Strings<BC, VC>
Source§const SLICE_COUNT: usize
const SLICE_COUNT: usize
The number of byte slices this type consumes when reconstructed.
Source§fn from_bytes(bytes: &mut impl Iterator<Item = &'a [u8]>) -> Self
fn from_bytes(bytes: &mut impl Iterator<Item = &'a [u8]>) -> Self
Reconstructs
self from a sequence of correctly aligned and sized bytes slices. Read moreSource§fn from_store(store: &DecodedStore<'a>, offset: &mut usize) -> Self
fn from_store(store: &DecodedStore<'a>, offset: &mut usize) -> Self
Source§impl<'a, BC: Len + IndexAs<u64>> Index for &'a Strings<BC, Vec<u8>>
impl<'a, BC: Len + IndexAs<u64>> Index for &'a Strings<BC, Vec<u8>>
Source§impl<'a, BC: Len + IndexAs<u64>> Index for Strings<BC, &'a [u8]>
impl<'a, BC: Len + IndexAs<u64>> Index for Strings<BC, &'a [u8]>
impl<BC: Copy, VC: Copy> Copy for Strings<BC, VC>
impl<BC, VC> StructuralPartialEq for Strings<BC, VC>
Auto Trait Implementations§
impl<BC, VC> Freeze for Strings<BC, VC>
impl<BC, VC> RefUnwindSafe for Strings<BC, VC>where
BC: RefUnwindSafe,
VC: RefUnwindSafe,
impl<BC, VC> Send for Strings<BC, VC>
impl<BC, VC> Sync for Strings<BC, VC>
impl<BC, VC> Unpin for Strings<BC, VC>
impl<BC, VC> UnsafeUnpin for Strings<BC, VC>where
BC: UnsafeUnpin,
VC: UnsafeUnpin,
impl<BC, VC> UnwindSafe for Strings<BC, VC>where
BC: UnwindSafe,
VC: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more