pub struct IntlNumbers(pub &'static dyn Host);Available on crate feature
intl only.Expand description
A host with numbers through Intl (feature intl): the number methods
here, every other method from the host it wraps — crate::HOST, or
a date host (IntlNumbers(&INTL_HOST) for a corpus with dates under
datetime-intl). Its own static, like the date hosts, so a client that
formats no numbers names a host without this glue (B1′). It forwards
each Host method; a method added to the trait later must be forwarded
here too.
Tuple Fields§
§0: &'static dyn HostTrait Implementations§
Source§impl Clone for IntlNumbers
impl Clone for IntlNumbers
impl Copy for IntlNumbers
Source§impl Host for IntlNumbers
impl Host for IntlNumbers
Source§fn nfc<'a>(&self, s: &'a str, buf: &'a mut String) -> &'a str
fn nfc<'a>(&self, s: &'a str, buf: &'a mut String) -> &'a str
The NFC form of
s, which failed the quick check (it has a code point
at or above U+0300). buf is scratch the result may live in.Source§fn f64_to_text<'b>(&self, x: f64, buf: &'b mut [u8; 32]) -> Option<&'b str>
fn f64_to_text<'b>(&self, x: f64, buf: &'b mut [u8; 32]) -> Option<&'b str>
The shortest decimal text that round-trips the finite
x, written
into buf: any form number-literal accepts, with an optional + in
the exponent (ryu’s 4.2, 1e21, 1.5e-7 and JavaScript’s
String(x) both qualify). None if the host cannot produce it.Source§fn zone_offset(&self, zone: &str, epoch_ms: i64) -> Option<i32>
fn zone_offset(&self, zone: &str, epoch_ms: i64) -> Option<i32>
The UTC offset, in seconds east, of the IANA time zone
zone at the
instant epoch_ms (milliseconds since the epoch). None: the host
has no zone data, or knows no such zone (the default) — a date/time
function that must convert an instant to a named zone then reports
Bad Option and a fallback value (datetime.md allows it; a wall time
in the wrong zone would be worse).Source§fn format_date_time(
&self,
locale: &str,
request: &DateTimeRequest<'_>,
out: &mut dyn Sink,
) -> bool
fn format_date_time( &self, locale: &str, request: &DateTimeRequest<'_>, out: &mut dyn Sink, ) -> bool
datetime-intl: writes request formatted by the host’s date
formatter (the browser’s Intl.DateTimeFormat) for locale, and
returns true; false (the default) when the host has none.Source§fn numbers(&self) -> Option<&dyn NumberFormatter>
fn numbers(&self) -> Option<&dyn NumberFormatter>
intl: the host’s number formatter (in the browser Intl.NumberFormat
and Intl.PluralRules, when the engine has Intl.NumberFormat v3);
None (the default) when it has none — the numeric functions of an
intl client then show exact digits and report Unsupported
Operation (plans/03-runtime.md §2.7).Auto Trait Implementations§
impl !RefUnwindSafe for IntlNumbers
impl !UnwindSafe for IntlNumbers
impl Freeze for IntlNumbers
impl Send for IntlNumbers
impl Sync for IntlNumbers
impl Unpin for IntlNumbers
impl UnsafeUnpin for IntlNumbers
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more