pub struct SmallStr { /* private fields */ }Expand description
A borrowed version of SmallStr.
Implementations§
Source§impl SmallStr
impl SmallStr
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
ⓘ
use pijul_core::small_string::*;
let mut s = SmallString::from_str("");
assert!(s.as_small_str().is_empty());
s.push_str("blah");
assert!(!s.as_small_str().is_empty());Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
ⓘ
use pijul_core::small_string::*;
let mut s = SmallString::from_str("blah");
assert_eq!(s.as_small_str().len(), "blah".len())pub fn as_str(&self) -> &str
pub fn as_bytes(&self) -> &[u8] ⓘ
pub fn to_owned(&self) -> SmallString
Trait Implementations§
Source§impl AsMut<SmallStr> for SmallString
impl AsMut<SmallStr> for SmallString
Source§impl AsRef<SmallStr> for SmallString
impl AsRef<SmallStr> for SmallString
impl Eq for SmallStr
Source§impl PartialOrd for SmallStr
impl PartialOrd for SmallStr
Source§impl Storable for SmallStr
impl Storable for SmallStr
Source§type PageReferences = Empty<u64>
type PageReferences = Empty<u64>
An iterator over the offsets to pages contained in this
value. Only values from this crate can generate non-empty
iterators, but combined values (like tuples) must chain the
iterators returned by method
page_offsets.Source§fn compare<T>(&self, _: &T, x: &Self) -> Ordering
fn compare<T>(&self, _: &T, x: &Self) -> Ordering
This is required for B trees, not necessarily for other
structures. The default implementation panics.
Source§fn page_references(&self) -> Self::PageReferences
fn page_references(&self) -> Self::PageReferences
If this value is an offset to another page at offset
offset,
return Some(offset). Return None else.Source§impl UnsizedStorable for SmallStr
impl UnsizedStorable for SmallStr
const ALIGN: usize = 1
Source§fn size(&self) -> usize
fn size(&self) -> usize
If
Self::SIZE.is_some(), this must return the same
value. The default implementation is Self;:SIZE.unwrap().Source§unsafe fn write_to_page(&self, p: *mut u8)
unsafe fn write_to_page(&self, p: *mut u8)
Write to a page. Must not overwrite the allocated size, but
this isn’t checked (which is why it’s unsafe).
unsafe fn from_raw_ptr<'a, T>(_: &T, p: *const u8) -> &'a Self
Auto Trait Implementations§
impl !Sized for SmallStr
impl Freeze for SmallStr
impl RefUnwindSafe for SmallStr
impl Send for SmallStr
impl Sync for SmallStr
impl Unpin for SmallStr
impl UnsafeUnpin for SmallStr
impl UnwindSafe for SmallStr
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
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.