[]Struct astral::string::StringId

pub struct StringId(_);

An opaque struct for fast comparison between strings.

StringId represents a unique identifier to a string.

Example

use astral::string::StringId;

let id1 = StringId::new("foo", &string_subsystem);
let id2 = StringId::new("bar", &string_subsystem);
let id3 = StringId::new("foo", &string_subsystem);

assert_ne!(id1, id2);
assert_eq!(id1, id3);

Methods

impl StringId

pub fn new<S>(
    string: S,
    subsystem: &Subsystem<BuildHasherDefault<Murmur3>>
) -> StringId where
    S: AsRef<str>, 

Construcs a new StringId from the given string in the specified Subsystem.

If the string was used before, the StringId will be equal.

Example

Trait Implementations

impl Copy for StringId

impl Eq for StringId

impl PartialEq<StringId> for StringId

impl Debug for StringId

impl Hash for StringId

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl Clone for StringId

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl Send for StringId

impl Sync for StringId

Blanket Implementations

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

type Owned = T

impl<T> From for T[src]

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

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> SendSyncUnwindSafe for T where
    T: Send + Sync + UnwindSafe + ?Sized