#[non_exhaustive]pub enum Unit {
Year = 0,
Month = 1,
Week = 2,
Day = 3,
Hour = 4,
Minute = 5,
Second = 6,
Millisecond = 7,
Microsecond = 8,
Nanosecond = 9,
}Expand description
A date or time unit, as accepted by the smallestUnit and unit options.
Each method accepts only a subset of these; for example Instant methods
reject calendar units and toString() accepts Minute and smaller only.
Out-of-range units are reported as a RangeError by the engine.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Year = 0
Month = 1
Week = 2
Day = 3
Hour = 4
Minute = 5
Second = 6
Millisecond = 7
Microsecond = 8
Nanosecond = 9
Implementations§
Trait Implementations§
impl Copy for Unit
impl Eq for Unit
Source§impl FromWasmAbi for Unit
impl FromWasmAbi for Unit
Source§impl IntoWasmAbi for Unit
impl IntoWasmAbi for Unit
Source§impl NullableFromWasmAbi for Unit
impl NullableFromWasmAbi for Unit
Source§impl NullableIntoWasmAbi for Unit
impl NullableIntoWasmAbi for Unit
Source§impl OptionFromWasmAbi for Unit
impl OptionFromWasmAbi for Unit
Source§impl OptionIntoWasmAbi for Unit
impl OptionIntoWasmAbi for Unit
impl StructuralPartialEq for Unit
Source§impl TryFromJsValue for Unit
impl TryFromJsValue for Unit
Source§impl VectorFromWasmAbi for Unit
impl VectorFromWasmAbi for Unit
Source§impl VectorIntoWasmAbi for Unit
impl VectorIntoWasmAbi for Unit
Source§impl VectorRefIntoWasmAbi for Unit
impl VectorRefIntoWasmAbi for Unit
fn slice_into_abi(slice: &[Self]) -> WasmSlice
impl VectorRefIntoWasmAbiSealed for Unit
Auto Trait Implementations§
impl Forget for Unit
impl Freeze for Unit
impl Move for Unit
impl RefUnwindSafe for Unit
impl Send for Unit
impl Sync for Unit
impl Unpin for Unit
impl UnsafeUnpin for Unit
impl UnwindSafe for Unit
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> MaybeFromWasmAbi for Twhere
T: OptionFromWasmAbi,
impl<T> MaybeFromWasmAbi for Twhere
T: OptionFromWasmAbi,
Source§type MaybeAbi = <T as FromWasmAbi>::Abi
type MaybeAbi = <T as FromWasmAbi>::Abi
The ABI of
Option<Self>.Source§unsafe fn from_maybe_abi(js: <T as FromWasmAbi>::Abi) -> T
unsafe fn from_maybe_abi(js: <T as FromWasmAbi>::Abi) -> T
unsafe fn try_from_maybe_abi( js: <T as FromWasmAbi>::Abi, ) -> Result<T, &'static str>
Source§impl<T> MaybeIntoWasmAbi for Twhere
T: OptionIntoWasmAbi,
impl<T> MaybeIntoWasmAbi for Twhere
T: OptionIntoWasmAbi,
Source§type MaybeAbi = <T as IntoWasmAbi>::Abi
type MaybeAbi = <T as IntoWasmAbi>::Abi
The ABI of
Option<Self>.Source§fn into_maybe_abi(self) -> <T as IntoWasmAbi>::Abi
fn into_maybe_abi(self) -> <T as IntoWasmAbi>::Abi
Converts a value into the
Option<Self> ABI.Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
Same as
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
Same as
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.