[−][src]Struct unic_locale::extensions::PrivateExtensionList
A list of Unicode Private Extensions
as defined in Unicode Locale Identifier
specification.
Those extensions are intended for pass-through
use.
Examples
use unic_locale_impl::Locale; let mut loc: Locale = "en-US-x-foo-faa".parse() .expect("Parsing failed."); assert_eq!(loc.extensions.private.has_tag("faa"), Ok(true)); assert_eq!(loc.extensions.private.tags().next(), Some("faa")); // tags got sorted loc.extensions.private.clear_tags(); assert_eq!(loc.to_string(), "en-US");
Methods
impl PrivateExtensionList
[src]
pub fn is_empty(&self) -> bool
[src]
Returns true
if there are no tags in the PrivateExtensionList`.
Examples
use unic_locale_impl::Locale; let mut loc: Locale = "en-US-x-foo".parse() .expect("Parsing failed."); assert_eq!(loc.extensions.private.is_empty(), false);
pub fn has_tag<S>(&self, tag: S) -> Result<bool, LocaleError> where
S: AsRef<[u8]>,
[src]
S: AsRef<[u8]>,
Returns true
if tag is included in the PrivateExtensionList
.
Examples
use unic_locale_impl::Locale; let mut loc: Locale = "en-US-x-foo".parse() .expect("Parsing failed."); assert_eq!(loc.extensions.private.has_tag("foo") .expect("Getting tag failed."), true);
pub fn tags(&self) -> impl ExactSizeIterator
[src]
Returns an iterator over all tags in the PrivateExtensionList
.
Examples
use unic_locale_impl::Locale; let mut loc: Locale = "en-US-x-foo-bar".parse() .expect("Parsing failed."); assert_eq!(loc.extensions.private.tags().collect::<Vec<_>>(), &["bar", "foo"]);
pub fn add_tag<S>(&mut self, tag: S) -> Result<(), LocaleError> where
S: AsRef<[u8]>,
[src]
S: AsRef<[u8]>,
Adds a tag to the PrivateExtensionList
.
Examples
use unic_locale_impl::Locale; let mut loc: Locale = "en-US".parse() .expect("Parsing failed."); loc.extensions.private.add_tag("foo") .expect("Adding tag failed."); assert_eq!(loc.to_string(), "en-US-x-foo");
pub fn remove_tag<S>(&mut self, tag: S) -> Result<bool, LocaleError> where
S: AsRef<[u8]>,
[src]
S: AsRef<[u8]>,
Removes a tag from the PrivateExtensionList
.
Returns true
if tag was included in the PrivateExtensionList
before
removal.
Examples
use unic_locale_impl::Locale; let mut loc: Locale = "en-US-x-foo".parse() .expect("Parsing failed."); assert_eq!(loc.extensions.private.remove_tag("foo") .expect("Removing tag failed."), true); assert_eq!(loc.to_string(), "en-US");
pub fn clear_tags(&mut self)
[src]
Clears all tags from the PrivateExtensionList
.
Examples
use unic_locale_impl::Locale; let mut loc: Locale = "en-US-x-foo".parse() .expect("Parsing failed."); loc.extensions.private.clear_tags(); assert_eq!(loc.to_string(), "en-US");
Trait Implementations
impl Clone for PrivateExtensionList
[src]
fn clone(&self) -> PrivateExtensionList
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for PrivateExtensionList
[src]
impl Default for PrivateExtensionList
[src]
fn default() -> PrivateExtensionList
[src]
impl Display for PrivateExtensionList
[src]
impl Eq for PrivateExtensionList
[src]
impl Hash for PrivateExtensionList
[src]
fn hash<__H>(&self, state: &mut __H) where
__H: Hasher,
[src]
__H: Hasher,
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for PrivateExtensionList
[src]
fn cmp(&self, other: &PrivateExtensionList) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<PrivateExtensionList> for PrivateExtensionList
[src]
fn eq(&self, other: &PrivateExtensionList) -> bool
[src]
fn ne(&self, other: &PrivateExtensionList) -> bool
[src]
impl PartialOrd<PrivateExtensionList> for PrivateExtensionList
[src]
fn partial_cmp(&self, other: &PrivateExtensionList) -> Option<Ordering>
[src]
fn lt(&self, other: &PrivateExtensionList) -> bool
[src]
fn le(&self, other: &PrivateExtensionList) -> bool
[src]
fn gt(&self, other: &PrivateExtensionList) -> bool
[src]
fn ge(&self, other: &PrivateExtensionList) -> bool
[src]
impl StructuralEq for PrivateExtensionList
[src]
impl StructuralPartialEq for PrivateExtensionList
[src]
Auto Trait Implementations
impl RefUnwindSafe for PrivateExtensionList
impl Send for PrivateExtensionList
impl Sync for PrivateExtensionList
impl Unpin for PrivateExtensionList
impl UnwindSafe for PrivateExtensionList
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,