pub trait IntoArg {
// Required method
fn into_arg(self) -> ArgValue;
}Expand description
A value a tr! argument converts from, by its type: a number, a string, a
date, a path, or an application’s own type.
tr!("id", name = value) converts value by the first of these its type
allows:
IntoArg— the typed conversion, below;- a
From<T> for ArgValueof the application’s own, as 1.x’str!converted every argument (and generic code bounded on it); Display— any other type with a text is an argument as that text, made when the description is built: anio::Error, anIpv4Addr, a key binding. The text is not translated; for a word that needs one, pass a string and select on it in the message (.match $state);- none of these — a compile error at the argument, in this trait’s words.
| Type | Is |
|---|---|
i8 … i128, u8 … u128, isize, usize, and their NonZero forms | an integer, exactly: past i64, the exact decimal |
f32, f64 | a floating-point number |
bool | the string true or false, which .match selects on |
char, &str, String, Arc<str>, Text | a string: an Arc<str> is shared as it is, other text is copied once into a shared string (a literal is kept as it is) |
Cow<'static, str> | a string; borrowed text stays borrowed |
&Path, PathBuf, &OsStr, OsString (with std: host-std, native or a Leptos mode) | its text, lossy where it is not UTF-8 |
SystemTime (with std) | an instant, to the millisecond; nothing past the years a date can hold |
jiff’s Timestamp, Zoned, civil::Date, civil::DateTime (with native) | a date: an instant, an instant with its zone, or a floating date and time |
DateTimeValue, the runtime’s DateTime | a date and time |
ArgValue | itself: an exact decimal, a value read at format time, … |
Arc<C> for a CustomValue | an application value a function reads |
| a signal of any of these (with a Leptos mode) | its value, read when the message is formatted |
&T for any of these that is Copy | what T is |
&String, &PathBuf, &OsString and jiff’s &Zoned are arguments too,
through From<&T> for ArgValue: a reference to a type that is not Copy
cannot also be an IntoArg beside the &T rule. A Cow that borrows for
less than 'static is refused by the borrow checker (the impl is for
'static text, which it keeps): pass &*cow, or the Cow owned.
An application implements it for a type that is a number, a date or a
value a custom function reads, which its Display text would not be:
use mf2::{ArgValue, IntoArg};
struct Celsius(f64);
impl IntoArg for Celsius {
fn into_arg(self) -> ArgValue {
self.0.into_arg()
}
}Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl IntoArg for &OsStr
Available on crate feature host-std, or crate feature native, or (crate features csr or hydrate or ssr) and (crate features leptos-0-8 or leptos) only.
impl IntoArg for &OsStr
host-std, or crate feature native, or (crate features csr or hydrate or ssr) and (crate features leptos-0-8 or leptos) only.Source§impl IntoArg for &Path
Available on crate feature host-std, or crate feature native, or (crate features csr or hydrate or ssr) and (crate features leptos-0-8 or leptos) only.
impl IntoArg for &Path
host-std, or crate feature native, or (crate features csr or hydrate or ssr) and (crate features leptos-0-8 or leptos) only.Source§impl IntoArg for Date
Available on crate feature native only.A floating date, at 00:00 (a date literal’s time).
impl IntoArg for Date
native only.A floating date, at 00:00 (a date literal’s time).
Source§impl IntoArg for DateTime
Available on crate feature native only.A floating date and time: no offset, so the formatting time zone
applies.
impl IntoArg for DateTime
native only.A floating date and time: no offset, so the formatting time zone applies.
Source§impl IntoArg for OsString
Available on crate feature host-std, or crate feature native, or (crate features csr or hydrate or ssr) and (crate features leptos-0-8 or leptos) only.
impl IntoArg for OsString
host-std, or crate feature native, or (crate features csr or hydrate or ssr) and (crate features leptos-0-8 or leptos) only.Source§impl IntoArg for PathBuf
Available on crate feature host-std, or crate feature native, or (crate features csr or hydrate or ssr) and (crate features leptos-0-8 or leptos) only.
impl IntoArg for PathBuf
host-std, or crate feature native, or (crate features csr or hydrate or ssr) and (crate features leptos-0-8 or leptos) only.Source§impl IntoArg for SystemTime
Available on crate feature host-std, or crate feature native, or (crate features csr or hydrate or ssr) and (crate features leptos-0-8 or leptos) only.The instant, to the millisecond (floored, as a date/time value holds
milliseconds); nothing (ArgValue::Unset) past the years a date
can hold.
impl IntoArg for SystemTime
host-std, or crate feature native, or (crate features csr or hydrate or ssr) and (crate features leptos-0-8 or leptos) only.The instant, to the millisecond (floored, as a date/time value holds
milliseconds); nothing (ArgValue::Unset) past the years a date
can hold.
Source§impl IntoArg for Timestamp
Available on crate feature native only.The instant, in UTC, to the millisecond (floored).
impl IntoArg for Timestamp
native only.The instant, in UTC, to the millisecond (floored).
Source§impl IntoArg for Zoned
Available on crate feature native only.The instant at its offset, in its IANA zone when it has one, so that
timeZone=input shows it there.
impl IntoArg for Zoned
native only.The instant at its offset, in its IANA zone when it has one, so that
timeZone=input shows it there.
Source§impl IntoArg for bool
The string true or false, as MF2 has no boolean: .match $flag selects
on it, and no allocation is made.
impl IntoArg for bool
The string true or false, as MF2 has no boolean: .match $flag selects
on it, and no allocation is made.
Source§impl IntoArg for u64
An integer that may not fit i64: exact either way. These five are out
of line, and share one decimal writer: inline, the branch and the call
went into every usize argument of a terminal UI (C1’s record).
impl IntoArg for u64
An integer that may not fit i64: exact either way. These five are out
of line, and share one decimal writer: inline, the branch and the call
went into every usize argument of a terminal UI (C1’s record).
Source§impl IntoArg for usize
Without saturating, where ArgValue::from (1.x) does: a usize past
i64::MAX is its exact decimal. On a 32-bit target (the browser’s) every
usize fits, and nothing else is compiled.
impl IntoArg for usize
Without saturating, where ArgValue::from (1.x) does: a usize past
i64::MAX is its exact decimal. On a 32-bit target (the browser’s) every
usize fits, and nothing else is compiled.
Source§impl<T: IntoArg + Copy> IntoArg for &T
A reference to a Copy argument is what the value is: &count.
impl<T: IntoArg + Copy> IntoArg for &T
A reference to a Copy argument is what the value is: &count.
Source§impl<T> IntoArg for ArcReadSignal<T>
Available on crate features csr or hydrate or ssr only.
impl<T> IntoArg for ArcReadSignal<T>
csr or hydrate or ssr only.Source§impl<T> IntoArg for ArcRwSignal<T>
Available on crate features csr or hydrate or ssr only.
impl<T> IntoArg for ArcRwSignal<T>
csr or hydrate or ssr only.Source§impl<T> IntoArg for ReadSignal<T>
Available on crate features csr or hydrate or ssr only.
impl<T> IntoArg for ReadSignal<T>
csr or hydrate or ssr only.