Function spinoso_symbol::unicode_case_eq[][src]

pub fn unicode_case_eq<T, U>(
    interner: &T,
    left: U,
    right: U,
    fold: CaseFold
) -> Result<Option<bool>, T::Error> where
    T: Intern<Symbol = U>,
    U: Copy
This is supported on crate feature artichoke only.

Compare the byte contents of two symbols using Unicode case-folding comparison for equality.

The byteslice associated with each symbol is resolved via the given interner. Unresolved symbols are compared as if they resolve to &[].

This comparison function attempts to convert each symbol’s byte content to a UTF-8 str. If both symbols resolve to UTF-8 contents, Unicode case folding is used when comparing the contents and this function returns Ok(Some(bool)). If neither symbol resolves to UTF-8 contents, this function falls back to ascii_casecmp and returns Ok(Some(bool)). Otherwise, the two symbols have byte contents with different encodings and Ok(None) is returned.

This function can be used to implement Symbol#casecmp? for the Symbol type defined in Ruby Core.

Errors

If the interner returns an error while retrieving a symbol, that error is returned. See Intern::lookup_symbol.