icu_collections/codepointtrie/
error.rs

1// This file is part of ICU4X. For terms of use, please see the file
2// called LICENSE at the top level of the ICU4X source tree
3// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).
4
5//! Custom error type(s) for the parent module.
6
7use displaydoc::Display;
8
9/// A custom error type for [`CodePointTrie`](super::CodePointTrie).
10#[derive(#[automatically_derived]
impl ::core::marker::Copy for Error { }Copy, #[automatically_derived]
impl ::core::clone::Clone for Error {
    #[inline]
    fn clone(&self) -> Error {
        let _: ::core::clone::AssertParamIsClone<&'static str>;
        *self
    }
}Clone, #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
const _: () =
    {
        impl ::core::fmt::Display for Error {
            fn fmt(&self, formatter: &mut ::core::fmt::Formatter)
                -> ::core::fmt::Result {

                #[allow(unused_variables)]
                match self {
                    Self::FromDeserialized { reason } => {
                        formatter.write_fmt(format_args!("Could not construct CodePointTrie from deserialized values: {0}",
                                reason))
                    }
                    Self::EmptyDataVector => {
                        formatter.write_fmt(format_args!("CodePointTrie must be constructed from data vector with at least one element"))
                    }
                }
            }
        }
    };Display, #[automatically_derived]
impl ::core::fmt::Debug for Error {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            Error::FromDeserialized { reason: __self_0 } =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "FromDeserialized", "reason", &__self_0),
            Error::EmptyDataVector =>
                ::core::fmt::Formatter::write_str(f, "EmptyDataVector"),
        }
    }
}Debug, #[automatically_derived]
impl ::core::cmp::PartialEq for Error {
    #[inline]
    fn eq(&self, other: &Error) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (Error::FromDeserialized { reason: __self_0 },
                    Error::FromDeserialized { reason: __arg1_0 }) =>
                    __self_0 == __arg1_0,
                _ => true,
            }
    }
}PartialEq)]
11#[non_exhaustive]
12pub enum Error {
13    /// Could not construct [`CodePointTrie`](super::CodePointTrie) from deserialized values
14    #[displaydoc("Could not construct CodePointTrie from deserialized values: {reason}")]
15    FromDeserialized {
16        /// Reason for inability to deserialize values.
17        reason: &'static str,
18    },
19    /// [`CodePointTrie`](super::CodePointTrie) must be constructed from data vector with at least one element
20    #[displaydoc("CodePointTrie must be constructed from data vector with at least one element")]
21    EmptyDataVector,
22}
23
24impl core::error::Error for Error {}