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

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

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

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>>()[..]
);

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

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Formats the value using the given formatter. Read more

Create a ResourceOptions with the given language identifier and an empty variant field.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Writes bytes to the given sink. Errors from the sink are bubbled up.

Returns a hint for the number of bytes that will be written to the sink. Read more

Creates a new String with the data from this Writeable. Like ToString, but smaller and faster. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Clone this trait object reference, returning a boxed trait object.

Return this boxed trait object as Box<dyn Any>. Read more

Return this trait object reference as &dyn Any. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.