time/error/
try_from_parsed.rs1use core::fmt;
4
5use crate::error;
6
7#[non_exhaustive]
9#[allow(variant_size_differences, reason = "only triggers on some platforms")]
10#[derive(#[automatically_derived]
#[allow(variant_size_differences, reason = "only triggers on some platforms")]
impl ::core::fmt::Debug for TryFromParsed {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
TryFromParsed::InsufficientInformation =>
::core::fmt::Formatter::write_str(f,
"InsufficientInformation"),
TryFromParsed::ComponentRange(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"ComponentRange", &__self_0),
}
}
}Debug, #[automatically_derived]
#[allow(variant_size_differences, reason = "only triggers on some platforms")]
impl ::core::clone::Clone for TryFromParsed {
#[inline]
fn clone(&self) -> TryFromParsed {
let _: ::core::clone::AssertParamIsClone<error::ComponentRange>;
*self
}
}Clone, #[automatically_derived]
#[allow(variant_size_differences, reason = "only triggers on some platforms")]
impl ::core::marker::Copy for TryFromParsed { }Copy, #[automatically_derived]
#[allow(variant_size_differences, reason = "only triggers on some platforms")]
impl ::core::cmp::PartialEq for TryFromParsed {
#[inline]
fn eq(&self, other: &TryFromParsed) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr &&
match (self, other) {
(TryFromParsed::ComponentRange(__self_0),
TryFromParsed::ComponentRange(__arg1_0)) =>
__self_0 == __arg1_0,
_ => true,
}
}
}PartialEq, #[automatically_derived]
#[allow(variant_size_differences, reason = "only triggers on some platforms")]
impl ::core::cmp::Eq for TryFromParsed {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<error::ComponentRange>;
}
}Eq)]
11pub enum TryFromParsed {
12 InsufficientInformation,
15 ComponentRange(error::ComponentRange),
17}
18
19impl fmt::Display for TryFromParsed {
20 #[inline]
21 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
22 match self {
23 Self::InsufficientInformation => f.write_str(
24 "the `Parsed` struct did not include enough information to construct the type",
25 ),
26 Self::ComponentRange(err) => err.fmt(f),
27 }
28 }
29}
30
31impl From<error::ComponentRange> for TryFromParsed {
32 #[inline]
33 fn from(v: error::ComponentRange) -> Self {
34 Self::ComponentRange(v)
35 }
36}
37
38impl TryFrom<TryFromParsed> for error::ComponentRange {
39 type Error = error::DifferentVariant;
40
41 #[inline]
42 fn try_from(err: TryFromParsed) -> Result<Self, Self::Error> {
43 match err {
44 TryFromParsed::ComponentRange(err) => Ok(err),
45 _ => Err(error::DifferentVariant),
46 }
47 }
48}
49
50impl core::error::Error for TryFromParsed {
51 #[inline]
52 fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
53 match self {
54 Self::InsufficientInformation => None,
55 Self::ComponentRange(err) => Some(err),
56 }
57 }
58}
59
60impl From<TryFromParsed> for crate::Error {
61 #[inline]
62 fn from(original: TryFromParsed) -> Self {
63 Self::TryFromParsed(original)
64 }
65}
66
67impl TryFrom<crate::Error> for TryFromParsed {
68 type Error = error::DifferentVariant;
69
70 #[inline]
71 fn try_from(err: crate::Error) -> Result<Self, Self::Error> {
72 match err {
73 crate::Error::TryFromParsed(err) => Ok(err),
74 _ => Err(error::DifferentVariant),
75 }
76 }
77}