Struct CodePointInversionListAndStringList

struct CodePointInversionListAndStringList<'data> { ... }

A data structure providing a concrete implementation of a set of code points and strings, using an inversion list for the code points.

This is what ICU4C calls a UnicodeSet.

Implementations

impl<'data> CodePointInversionListAndStringList<'data>

fn try_from(cp_inv_list: CodePointInversionList<'data>, str_list: VarZeroVec<'data, str>) -> Result<Self, InvalidStringList>

Returns a new CodePointInversionListAndStringList from both a CodePointInversionList for the code points and a VarZeroVec<str> of strings.

fn size(self: &Self) -> usize

Returns the number of elements in this set (its cardinality). Note than the elements of a set may include both individual codepoints and strings.

fn has_strings(self: &Self) -> bool

Return true if this set contains multi-code point strings or the empty string.

fn contains_str(self: &Self, s: &str) -> bool

Examples

use icu::collections::codepointinvlist::CodePointInversionList;
use icu::collections::codepointinvliststringlist::CodePointInversionListAndStringList;
use zerovec::VarZeroVec;

let cp_slice = &[0, 0x1_0000, 0x10_FFFF, 0x11_0000];
let cp_list =
   CodePointInversionList::try_from_u32_inversion_list_slice(cp_slice).unwrap();
let str_slice = &["", "bmp_max", "unicode_max", "zero"];
let str_list = VarZeroVec::<str>::from(str_slice);

let cpilsl = CodePointInversionListAndStringList::try_from(cp_list, str_list).unwrap();

assert!(cpilsl.contains_str("bmp_max"));
assert!(cpilsl.contains_str(""));
assert!(cpilsl.contains_str("A"));
assert!(cpilsl.contains_str(""));  // U+1254 ETHIOPIC SYLLABLE QHEE
assert!(!cpilsl.contains_str("bazinga!"));
fn contains32(self: &Self, cp: u32) -> bool

Examples

use icu::collections::codepointinvlist::CodePointInversionList;
use icu::collections::codepointinvliststringlist::CodePointInversionListAndStringList;
use zerovec::VarZeroVec;

let cp_slice = &[0, 0x80, 0xFFFF, 0x1_0000, 0x10_FFFF, 0x11_0000];
let cp_list =
    CodePointInversionList::try_from_u32_inversion_list_slice(cp_slice).unwrap();
let str_slice = &["", "ascii_max", "bmp_max", "unicode_max", "zero"];
let str_list = VarZeroVec::<str>::from(str_slice);

let cpilsl = CodePointInversionListAndStringList::try_from(cp_list, str_list).unwrap();

assert!(cpilsl.contains32(0));
assert!(cpilsl.contains32(0x0042));
assert!(!cpilsl.contains32(0x0080));
fn contains(self: &Self, ch: char) -> bool

Examples

use icu::collections::codepointinvlist::CodePointInversionList;
use icu::collections::codepointinvliststringlist::CodePointInversionListAndStringList;
use zerovec::VarZeroVec;

let cp_slice = &[0, 0x1_0000, 0x10_FFFF, 0x11_0000];
let cp_list =
   CodePointInversionList::try_from_u32_inversion_list_slice(cp_slice).unwrap();
let str_slice = &["", "bmp_max", "unicode_max", "zero"];
let str_list = VarZeroVec::<str>::from(str_slice);

let cpilsl = CodePointInversionListAndStringList::try_from(cp_list, str_list).unwrap();

assert!(cpilsl.contains('A'));
assert!(cpilsl.contains(''));  // U+1254 ETHIOPIC SYLLABLE QHEE
assert!(!cpilsl.contains('\u{1_0000}'));
assert!(!cpilsl.contains('🨫'));  // U+1FA2B NEUTRAL CHESS TURNED QUEEN
fn code_points(self: &Self) -> &CodePointInversionList<'data>

Access the underlying CodePointInversionList.

fn strings(self: &Self) -> &VarZeroSlice<str>

Access the contained strings.

impl<'a> Yokeable for CodePointInversionListAndStringList<'static>

fn transform(self: &'a Self) -> &'a <Self as >::Output
fn transform_owned(self: Self) -> <Self as >::Output
unsafe fn make(this: <Self as >::Output) -> Self
fn transform_mut<F>(self: &'a mut Self, f: F)
where
    F: 'static + for<'b> FnOnce(&'b mut <Self as >::Output)

impl<'data> Clone for CodePointInversionListAndStringList<'data>

fn clone(self: &Self) -> CodePointInversionListAndStringList<'data>

impl<'data> Debug for CodePointInversionListAndStringList<'data>

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

impl<'data> EncodeAsVarULE for CodePointInversionListAndStringList<'data>

fn encode_var_ule_as_slices<R, impl FnOnce(&[&[u8]]) -> R: FnOnce(&[&[u8]]) -> R>(self: &Self, cb: impl FnOnce(&[&[u8]]) -> R) -> R
fn encode_var_ule_len(self: &Self) -> usize
fn encode_var_ule_write(self: &Self, dst: &mut [u8])

impl<'data> Eq for CodePointInversionListAndStringList<'data>

impl<'data> Freeze for CodePointInversionListAndStringList<'data>

impl<'data> From for CodePointInversionListAndStringList<'data>

fn from(other: &'data CodePointInversionListAndStringListULE) -> Self

impl<'data> PartialEq for CodePointInversionListAndStringList<'data>

fn eq(self: &Self, other: &CodePointInversionListAndStringList<'data>) -> bool

impl<'data> RefUnwindSafe for CodePointInversionListAndStringList<'data>

impl<'data> Send for CodePointInversionListAndStringList<'data>

impl<'data> StructuralPartialEq for CodePointInversionListAndStringList<'data>

impl<'data> Sync for CodePointInversionListAndStringList<'data>

impl<'data> Unpin for CodePointInversionListAndStringList<'data>

impl<'data> UnsafeUnpin for CodePointInversionListAndStringList<'data>

impl<'data> UnwindSafe for CodePointInversionListAndStringList<'data>

impl<'data> ZeroFrom for CodePointInversionListAndStringList<'data>

fn zero_from(other: &'data CodePointInversionListAndStringListULE) -> Self

impl<'zf, 'zf_inner> ZeroFrom for CodePointInversionListAndStringList<'zf>

fn zero_from(this: &'zf CodePointInversionListAndStringList<'zf_inner>) -> Self

impl<T> Any for CodePointInversionListAndStringList<'data>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for CodePointInversionListAndStringList<'data>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for CodePointInversionListAndStringList<'data>

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> CloneToUninit for CodePointInversionListAndStringList<'data>

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> ErasedDestructor for CodePointInversionListAndStringList<'data>

impl<T> From for CodePointInversionListAndStringList<'data>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for CodePointInversionListAndStringList<'data>

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T, U> Into for CodePointInversionListAndStringList<'data>

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for CodePointInversionListAndStringList<'data>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for CodePointInversionListAndStringList<'data>

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>