pub enum NeoTimeZoneOffsetShortMarker {}
Expand description

“GMT-05:00” ⇒ UTC offset with a shorter length

§Examples

In NeoFormatter:

use icu::timezone::CustomTimeZone;
use icu::datetime::neo::NeoFormatter;
use icu::datetime::neo_marker::NeoTimeZoneOffsetShortMarker;
use icu::datetime::neo_skeleton::NeoSkeletonLength;
use icu::locale::locale;
use tinystr::tinystr;
use writeable::assert_try_writeable_eq;

let fmt = NeoFormatter::<NeoTimeZoneOffsetShortMarker>::try_new(
    &locale!("en").into(),
    Default :: default(),
)
.unwrap();

// Time zone for America/Chicago in the summer
let zone = CustomTimeZone::from_parts(
    -40, // offset eighths of hour
    tinystr!(8, "uschi"), // time zone ID
    tinystr!(4, "amce"), // metazone ID
    tinystr!(2, "dt"), // zone variant: daylight time
);

assert_try_writeable_eq!(
    fmt.convert_and_format(&zone),
    "GMT-05:00"
);

In TypedNeoFormatter:

use icu::calendar::{Date, Time};
use icu::timezone::{CustomTimeZone, CustomZonedDateTime};
use icu::calendar::Gregorian;
use icu::datetime::neo::TypedNeoFormatter;
use icu::datetime::neo_marker::NeoTimeZoneOffsetShortMarker;
use icu::datetime::neo_skeleton::NeoSkeletonLength;
use icu::locale::locale;
use tinystr::tinystr;
use writeable::assert_try_writeable_eq;

let fmt = TypedNeoFormatter::<Gregorian, NeoTimeZoneOffsetShortMarker>::try_new(
    &locale!("en").into(),
    Default :: default(),
)
.unwrap();

// Time zone for America/Chicago in the summer
let zone = CustomTimeZone::from_parts(
    -40, // offset eighths of hour
    tinystr!(8, "uschi"), // time zone ID
    tinystr!(4, "amce"), // metazone ID
    tinystr!(2, "dt"), // zone variant: daylight time
);

assert_try_writeable_eq!(
    fmt.format(&zone),
    "GMT-05:00"
);

Trait Implementations§

source§

impl DateTimeMarkers for NeoTimeZoneOffsetShortMarker

§

type D = NeoNeverMarker

Associated types for date formatting. Read more
§

type T = NeoNeverMarker

Associated types for time formatting. Read more
§

type Z = NeoTimeZoneOffsetShortMarker

Associated types for time zone formatting. Read more
§

type LengthOption = NeverField

Type of the length option in the constructor.
§

type AlignmentOption = NeverField

Type of the alignment option in the constructor.
§

type EraDisplayOption = NeverField

Type of the era display option in the constructor.
§

type FractionalSecondDigitsOption = NeverField

Type of the fractional seconds display option in the constructor.
§

type GluePatternV1Marker = NeverMarker<GluePatternV1<'static>>

Marker for loading the date/time glue pattern.
source§

impl Debug for NeoTimeZoneOffsetShortMarker

source§

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

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

impl HasConstComponents for NeoTimeZoneOffsetShortMarker

source§

const COMPONENTS: NeoComponents = _

The associated components.
source§

impl HasConstZoneComponent for NeoTimeZoneOffsetShortMarker

source§

const COMPONENT: NeoTimeZoneSkeleton = _

The associated component.
source§

impl ZoneMarkers for NeoTimeZoneOffsetShortMarker

§

type TimeZoneOffsetInput = Option<UtcOffset>

Marker for resolving the time zone offset input field.
§

type TimeZoneIdInput = Option<TimeZoneBcp47Id>

Marker for resolving the time zone id input field.
§

type TimeZoneMetazoneInput = Option<MetazoneId>

Marker for resolving the time zone metazone input field.
§

type TimeZoneVariantInput = Option<ZoneVariant>

Marker for resolving the time zone variant input field.
§

type EssentialsV1Marker = TimeZoneFormatsV1Marker

Marker for loading core time zone data.
§

type ExemplarCitiesV1Marker = NeverMarker<ExemplarCitiesV1<'static>>

Marker for loading exemplar city names for time zone formatting
§

type GenericLongV1Marker = NeverMarker<MetazoneGenericNamesLongV1<'static>>

Marker for loading generic short time zone names.
§

type GenericShortV1Marker = NeverMarker<MetazoneGenericNamesShortV1<'static>>

Marker for loading generic short time zone names.
§

type SpecificLongV1Marker = NeverMarker<MetazoneSpecificNamesLongV1<'static>>

Marker for loading generic short time zone names.
§

type SpecificShortV1Marker = NeverMarker<MetazoneSpecificNamesShortV1<'static>>

Marker for loading generic short time zone names.

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> 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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

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

§

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>,

§

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.
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T
where T: Send + Sync,