Enum spinoso_string::CodepointsError
source · pub enum CodepointsError {
InvalidUtf8Codepoint,
}
Expand description
Error returned when failing to construct a Codepoints
iterator/
This error is returned from String::codepoints
. See its documentation
for more detail.
This error corresponds to the Ruby ArgumentError
Exception class.
When the std feature of spinoso-string
is enabled, this struct
implements std::error::Error
.
Variants§
InvalidUtf8Codepoint
Error returned when calling String::codepoints
on a String
with
UTF-8 encoding which is not a valid UTF-8 byte string.
Implementations§
source§impl CodepointsError
impl CodepointsError
pub const EXCEPTION_TYPE: &'static str = "ArgumentError"
sourcepub const fn invalid_utf8_codepoint() -> Self
pub const fn invalid_utf8_codepoint() -> Self
Create a new invalid UTF-8 codepoint CodepointsError
.
Examples
use spinoso_string::CodepointsError;
const ERR: CodepointsError = CodepointsError::invalid_utf8_codepoint();
assert_eq!(ERR.message(), "invalid byte sequence in UTF-8");
Trait Implementations§
source§impl Clone for CodepointsError
impl Clone for CodepointsError
source§fn clone(&self) -> CodepointsError
fn clone(&self) -> CodepointsError
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for CodepointsError
impl Debug for CodepointsError
source§impl Display for CodepointsError
impl Display for CodepointsError
source§impl Error for CodepointsError
impl Error for CodepointsError
1.30.0 · source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
1.0.0 · source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
source§impl Hash for CodepointsError
impl Hash for CodepointsError
source§impl Ord for CodepointsError
impl Ord for CodepointsError
source§fn cmp(&self, other: &CodepointsError) -> Ordering
fn cmp(&self, other: &CodepointsError) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq<CodepointsError> for CodepointsError
impl PartialEq<CodepointsError> for CodepointsError
source§fn eq(&self, other: &CodepointsError) -> bool
fn eq(&self, other: &CodepointsError) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<CodepointsError> for CodepointsError
impl PartialOrd<CodepointsError> for CodepointsError
source§fn partial_cmp(&self, other: &CodepointsError) -> Option<Ordering>
fn partial_cmp(&self, other: &CodepointsError) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read more