Enum spinoso_string::CenterError
source · pub enum CenterError {
ZeroWidthPadding,
}
Expand description
Error returned when failing to construct a Center
iterator.
This error is returned from String::center
. 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§
ZeroWidthPadding
Error returned when calling String::center
with an empty padding
byte string.
Implementations§
source§impl CenterError
impl CenterError
pub const EXCEPTION_TYPE: &'static str = "ArgumentError"
sourcepub const fn zero_width_padding() -> Self
pub const fn zero_width_padding() -> Self
Create a new zero width padding CenterError
.
Examples
use spinoso_string::CenterError;
const ERR: CenterError = CenterError::zero_width_padding();
assert_eq!(ERR.message(), "zero width padding");
Trait Implementations§
source§impl Clone for CenterError
impl Clone for CenterError
source§fn clone(&self) -> CenterError
fn clone(&self) -> CenterError
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 CenterError
impl Debug for CenterError
source§impl Display for CenterError
impl Display for CenterError
source§impl Error for CenterError
impl Error for CenterError
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 CenterError
impl Hash for CenterError
source§impl Ord for CenterError
impl Ord for CenterError
source§fn cmp(&self, other: &CenterError) -> Ordering
fn cmp(&self, other: &CenterError) -> 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<CenterError> for CenterError
impl PartialEq<CenterError> for CenterError
source§fn eq(&self, other: &CenterError) -> bool
fn eq(&self, other: &CenterError) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<CenterError> for CenterError
impl PartialOrd<CenterError> for CenterError
source§fn partial_cmp(&self, other: &CenterError) -> Option<Ordering>
fn partial_cmp(&self, other: &CenterError) -> 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