Struct Private

struct Private(_)

A list of Private Use Extensions as defined in Unicode Locale Identifier specification.

Those extensions are treated as a pass-through, and no Unicode related behavior depends on them.

Examples

use icu::locale::extensions::private::{Private, Subtag};

let subtag1: Subtag = "foo".parse().expect("Failed to parse a Subtag.");
let subtag2: Subtag = "bar".parse().expect("Failed to parse a Subtag.");

let private = Private::from_vec_unchecked(vec![subtag1, subtag2]);
assert_eq!(&private.to_string(), "x-foo-bar");

Implementations

impl Private

fn to_string(self: &Self) -> String

Converts the given value to a String.

Under the hood, this uses an efficient Writeable implementation. However, in order to avoid allocating a string, it is more efficient to use Writeable directly.

impl Private

const fn new() -> Self

Returns a new empty list of private-use extensions. Same as default(), but is const.

Examples

use icu::locale::extensions::private::Private;

assert_eq!(Private::new(), Private::default());
const fn new_single(input: Subtag) -> Self

A constructor which takes a single Subtag.

Examples

use icu::locale::extensions::private::{Private, Subtag};

let subtag: Subtag = "foo".parse().expect("Failed to parse a Subtag.");

let private = Private::new_single(subtag);
assert_eq!(&private.to_string(), "x-foo");
fn clear(self: &mut Self)

Empties the Private list.

Examples

use icu::locale::extensions::private::{Private, Subtag};

let subtag1: Subtag = "foo".parse().expect("Failed to parse a Subtag.");
let subtag2: Subtag = "bar".parse().expect("Failed to parse a Subtag.");
let mut private = Private::from_vec_unchecked(vec![subtag1, subtag2]);

assert_eq!(&private.to_string(), "x-foo-bar");

private.clear();

assert_eq!(private, Private::new());

impl Clone for Private

fn clone(self: &Self) -> Private

impl Debug for Private

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

impl Default for Private

fn default() -> Private

impl Deref for Private

fn deref(self: &Self) -> &<Self as >::Target

impl Display for Private

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

impl Eq for Private

impl Freeze for Private

impl Hash for Private

fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H)

impl Ord for Private

fn cmp(self: &Self, other: &Private) -> Ordering

impl PartialEq for Private

fn eq(self: &Self, other: &Private) -> bool

impl PartialOrd for Private

fn partial_cmp(self: &Self, other: &Private) -> Option<Ordering>

impl RefUnwindSafe for Private

impl Send for Private

impl StructuralPartialEq for Private

impl Sync for Private

impl Unpin for Private

impl UnsafeUnpin for Private

impl UnwindSafe for Private

impl Writeable for Private

fn write_to<W: core::fmt::Write + ?Sized>(self: &Self, sink: &mut W) -> Result
fn writeable_length_hint(self: &Self) -> LengthHint

impl<P, T> Receiver for Private

impl<T> Any for Private

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Private

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

impl<T> BorrowMut for Private

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

impl<T> CloneToUninit for Private

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

impl<T> ErasedDestructor for Private

impl<T> From for Private

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for Private

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

impl<T> ToString for Private

fn to_string(self: &Self) -> String

impl<T, U> Into for Private

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 Private

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

impl<T, U> TryInto for Private

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