[][src]Struct ijson::string::IString

#[repr(transparent)]pub struct IString(_);

The IString type is an interned, immutable string, and is where this crate gets its name.

Cloning an IString is cheap, and it can be easily converted from &str or String types. Comparisons between IStrings is a simple pointer comparison.

The memory backing an IString is reference counted, so that unlike many string interning libraries, memory is not leaked as new strings are interned. Interning uses DashSet, an implementation of a concurrent hash-set, allowing many strings to be interned concurrently without becoming a bottleneck.

Given the nature of IString it is better to intern a string once and reuse it, rather than continually convert from &str to IString.

Implementations

impl IString[src]

pub fn intern(s: &str) -> Self[src]

Converts a &str to an IString by interning it in the global string cache.

pub fn len(&self) -> usize[src]

Returns the length (in bytes) of this string.

pub fn is_empty(&self) -> bool[src]

Returns true if this is the empty string "".

pub fn as_str(&self) -> &str[src]

Obtains a &str from this IString. This is a cheap operation.

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

Obtains a byte slice from this IString. This is a cheap operation.

pub fn new() -> Self[src]

Returns the empty string.

Trait Implementations

impl AsMut<IValue> for IString[src]

impl AsRef<IValue> for IString[src]

impl Borrow<IValue> for IString[src]

impl Borrow<str> for IString[src]

impl BorrowMut<IValue> for IString[src]

impl Clone for IString[src]

impl Debug for IString[src]

impl Default for IString[src]

impl Deref for IString[src]

type Target = str

The resulting type after dereferencing.

impl<'de> Deserialize<'de> for IString[src]

impl<'de> Deserializer<'de> for &'de IString[src]

type Error = Error

The error type that can be returned if some error occurs during deserialization. Read more

impl Eq for IString[src]

impl<'_> From<&'_ String> for IString[src]

impl<'_> From<&'_ mut String> for IString[src]

impl<'_> From<&'_ mut str> for IString[src]

impl<'_> From<&'_ str> for IString[src]

impl From<IString> for IValue[src]

impl From<IString> for String[src]

impl From<String> for IString[src]

impl Hash for IString[src]

impl<'de> IntoDeserializer<'de, Error> for &'de IString[src]

type Deserializer = Self

The type of the deserializer being converted into.

impl<'_> ObjectIndex for &'_ IString[src]

impl Ord for IString[src]

impl PartialEq<IString> for IString[src]

impl PartialEq<IString> for str[src]

impl PartialEq<IString> for String[src]

impl PartialEq<String> for IString[src]

impl PartialEq<str> for IString[src]

impl PartialOrd<IString> for IString[src]

impl Serialize for IString[src]

impl<'a> TryFrom<&'a IValue> for &'a IString[src]

type Error = ()

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a mut IValue> for &'a mut IString[src]

type Error = ()

The type returned in the event of a conversion error.

impl TryFrom<IValue> for IString[src]

type Error = IValue

The type returned in the event of a conversion error.

impl<'_> ValueIndex for &'_ IString[src]

Auto Trait Implementations

impl RefUnwindSafe for IString

impl Send for IString

impl Sync for IString

impl Unpin for IString

impl UnwindSafe for IString

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.