Struct icu_provider::prelude::ResourceOptions[][src]

pub struct ResourceOptions {
    pub variant: Option<Cow<'static, str>>,
    pub langid: Option<LanguageIdentifier>,
}

A variant and language identifier, used for requesting data from a DataProvider.

The fields in a ResourceOptions are not generally known until runtime.

Fields

variant: Option<Cow<'static, str>>langid: Option<LanguageIdentifier>

Implementations

impl ResourceOptions[src]

pub fn get_components(&self) -> ResourceOptionsComponents[src]

Gets the standard path components of this ResourceOptions. These components should be used when persisting the ResourceOptions on the filesystem or in structured data.

Examples

use std::borrow::Cow;
use icu_provider::prelude::*;
use icu_locid_macros::langid;

let resc_options = ResourceOptions {
    variant: Some(Cow::Borrowed("GBP")),
    langid: Some(langid!("pt_BR")),
};
let components = resc_options.get_components();

assert_eq!(
    ["GBP", "pt-BR"],
    components.iter().collect::<Vec<&str>>()[..]
);

pub fn is_empty(&self) -> bool[src]

Returns whether this ResourceOptions has all empty fields (no components).

Trait Implementations

impl Clone for ResourceOptions[src]

impl Debug for ResourceOptions[src]

impl Default for ResourceOptions[src]

impl Display for ResourceOptions[src]

impl PartialEq<ResourceOptions> for ResourceOptions[src]

impl StructuralPartialEq for ResourceOptions[src]

impl Writeable for ResourceOptions[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

impl<T> ErasedDataStruct for T where
    T: Clone + Debug + Any
[src]

impl<T> From<T> for T[src]

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

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

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.