Skip to main content

SmallStr

Struct SmallStr 

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

A borrowed version of SmallStr.

Implementations§

Source§

impl SmallStr

Source

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());
Source

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())
Source

pub fn as_str(&self) -> &str

Source

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

Source

pub fn to_owned(&self) -> SmallString

Trait Implementations§

Source§

impl AsMut<SmallStr> for SmallString

Source§

fn as_mut(&mut self) -> &mut SmallStr

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl AsRef<SmallStr> for SmallString

Source§

fn as_ref(&self) -> &SmallStr

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Check for SmallStr

Source§

fn add_refs<T>( &self, _txn: &T, _refs: &mut BTreeMap<u64, usize>, ) -> Result<(), <T as LoadPage>::Error>
where T: LoadPage, <T as LoadPage>::Error: Debug,

Source§

impl Debug for SmallStr

Source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for SmallStr

Source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for SmallStr

Source§

impl Hash for SmallStr

Source§

fn hash<H: Hasher>(&self, hasher: &mut H)

Feeds this value into the given Hasher. Read more
Source§

impl Ord for SmallStr

Source§

fn cmp(&self, x: &SmallStr) -> Ordering

This method returns an Ordering between self and other. Read more
Source§

impl PartialEq for SmallStr

Source§

fn eq(&self, x: &SmallStr) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PartialOrd for SmallStr

Source§

fn partial_cmp(&self, x: &SmallStr) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Storable for SmallStr

Source§

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

This is required for B trees, not necessarily for other structures. The default implementation panics.
Source§

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§

unsafe fn drop<T>(&self, txn: &mut T) -> Result<(), <T as LoadPage>::Error>
where T: AllocPage,

If this value is an offset to another page at offset offset, return Some(offset). Return None else. Read more
Source§

impl UnsizedStorable for SmallStr

Source§

const ALIGN: usize = 1

Source§

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)

Write to a page. Must not overwrite the allocated size, but this isn’t checked (which is why it’s unsafe).
Source§

unsafe fn from_raw_ptr<'a, T>(_: &T, p: *const u8) -> &'a Self

Source§

unsafe fn onpage_size(p: *const u8) -> usize

Read the size from an on-page entry. If Self::SIZE.is_some() this must be the same value.
Source§

unsafe fn write_to_page_alloc<T>(&self, _: &mut T, p: *mut u8)
where T: AllocPage,

Write to a page. Must not overwrite the allocated size, but this isn’t checked (which is why it’s unsafe). Read more

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<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more