Skip to main content

Locale

Struct Locale 

Source
pub struct Locale { /* private fields */ }
Expand description

Locale

Implementations§

Source§

impl Locale

Source

pub async fn graphql_ietf( &self, _: &Context<'_>, ) -> Result<&'static [&'static str]>

Available on crate features async-graphql and alloc only.

Returns the IETF locale code (e.g. en-US)

Source

pub async fn graphql_timezones( &self, _: &Context<'_>, ) -> Result<&'static [&'static Timezone]>

Available on crate features async-graphql and alloc only.

Returns the list of tz database timezones

Source

pub async fn graphql_date_formats( &self, _: &Context<'_>, ) -> Result<&'static StaticMap<&'static str, &'static str>>

Available on crate features async-graphql and alloc only.

Returns date formats for each IETF locale.

  • Key is the IETF code
  • Value is the date format, where:
    • G = era
    • y = year
    • M = month
    • d = day
Source

pub async fn graphql_measurement_system( &self, _: &Context<'_>, ) -> Result<MeasurementSystem>

Available on crate features async-graphql and alloc only.

Returns system of measurement in use. see MeasurementSystem

Source

pub async fn graphql_hour_clock(&self, _: &Context<'_>) -> Result<HourClock>

Available on crate features async-graphql and alloc only.

Returns the type of clock used. see HourClock

Source

pub async fn graphql_driving_side(&self, _: &Context<'_>) -> Result<DrivingSide>

Available on crate features async-graphql and alloc only.

Returns the side of the road traffic drives on. see DrivingSide

Source

pub async fn graphql_distance_unit( &self, _: &Context<'_>, ) -> Result<DistanceUint>

Available on crate features async-graphql and alloc only.

Returns the unit of distance used (kilometer or mile). see DistanceUint

Source

pub async fn graphql_temperature_unit( &self, _: &Context<'_>, ) -> Result<TemperatureUint>

Available on crate features async-graphql and alloc only.

Returns the unit of temperature (celsius or fahrenheit). see TemperatureUint

Source

pub async fn graphql_week_start_on(&self, _: &Context<'_>) -> Result<Day>

Available on crate features async-graphql and alloc only.

Returns which day is the first day of the week on the calendar. see Day

Source§

impl Locale

Source

pub const fn ietf(&self) -> &'static [&'static str]

Returns the IETF locale code (e.g. en-US)

Source

pub const fn timezones(&self) -> &'static [&'static Timezone]

Returns the list of tz database timezones

Source

pub const fn date_formats( &self, ) -> &'static StaticMap<&'static str, &'static str>

Returns date formats for each IETF locale.

  • Key is the IETF code
  • Value is the date format, where:
    • G = era
    • y = year
    • M = month
    • d = day
Source

pub const fn measurement_system(&self) -> MeasurementSystem

Returns system of measurement in use. see MeasurementSystem

Source

pub const fn hour_clock(&self) -> HourClock

Returns the type of clock used. see HourClock

Source

pub const fn driving_side(&self) -> DrivingSide

Returns the side of the road traffic drives on. see DrivingSide

Source

pub const fn distance_unit(&self) -> DistanceUint

Returns the unit of distance used (kilometer or mile). see DistanceUint

Source

pub const fn temperature_unit(&self) -> TemperatureUint

Returns the unit of temperature (celsius or fahrenheit). see TemperatureUint

Source

pub const fn week_start_on(&self) -> Day

Returns which day is the first day of the week on the calendar. see Day

Trait Implementations§

Source§

impl Clone for Locale

Source§

fn clone(&self) -> Locale

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl ContainerType for Locale

Available on crate features async-graphql and alloc only.
Source§

fn resolve_field<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ctx: &'life1 Context<'life2>, ) -> Pin<Box<dyn Future<Output = ServerResult<Option<Value>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Resolves a field value and outputs it as a json value async_graphql::Value. Read more
Source§

fn find_entity<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, ctx: &'life1 Context<'life2>, params: &'life3 Value, ) -> Pin<Box<dyn Future<Output = ServerResult<Option<Value>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Find the GraphQL entity with the given name from the parameter. Read more
Source§

fn collect_all_fields<'a>( &'a self, ctx: &ContextBase<'a, &'a Positioned<SelectionSet>>, fields: &mut Fields<'a>, ) -> Result<(), ServerError>
where Self: Send + Sync,

Collect all the fields of the container that are queried in the selection set. Read more
Source§

impl Debug for Locale

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Hash for Locale

Source§

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

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for Locale

Source§

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

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl OutputType for Locale

Available on crate features async-graphql and alloc only.
Source§

fn type_name() -> Cow<'static, str>

Type the name.
Source§

fn create_type_info(registry: &mut Registry) -> String

Create type information in the registry and return qualified typename.
Source§

fn resolve<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, ctx: &'life1 ContextSelectionSet<'life2>, _field: &'life3 Positioned<Field>, ) -> Pin<Box<dyn Future<Output = ServerResult<Value>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Resolve an output value to async_graphql::Value.
Source§

fn qualified_type_name() -> String

Qualified typename.
Source§

fn introspection_type_name(&self) -> Cow<'static, str>

Introspection type name Read more
Source§

impl PartialEq for Locale

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Locale

Source§

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

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Serialize for Locale

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Copy for Locale

Source§

impl Eq for Locale

Source§

impl ObjectType for Locale

Available on crate features async-graphql and alloc only.
Source§

impl StructuralPartialEq for Locale

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T> RuleType for T
where T: Copy + Debug + Eq + Hash + Ord,