pub struct SqlState(/* private fields */);Expand description
A SQLSTATE error code, including
custom codes outside the standard, usable as a match pattern.
use sqlstate::{SqlState, SqlStateClass};
const CUSTOM: SqlState = SqlState::new(*b"P1001").unwrap();
let code: SqlState = "P1001".parse().unwrap();
assert!(matches!(code, CUSTOM));
assert_eq!(code.as_str(), "P1001");
assert_eq!(code.class().as_str(), "P1");
assert!(!code.class().is_standard());
assert_eq!(code.subclass(), "001");
let code: SqlState = "23505".parse().unwrap();
assert_eq!(code.class(), SqlStateClass::INTEGRITY_CONSTRAINT_VIOLATION);Implementations§
Trait Implementations§
impl Copy for SqlState
impl Eq for SqlState
Source§impl Ord for SqlState
impl Ord for SqlState
1.21.0 (const: unstable) · 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
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for SqlState
impl PartialOrd for SqlState
impl StructuralPartialEq for SqlState
Auto Trait Implementations§
impl Forget for SqlState
impl Freeze for SqlState
impl Move for SqlState
impl RefUnwindSafe for SqlState
impl Send for SqlState
impl Sync for SqlState
impl Unpin for SqlState
impl UnsafeUnpin for SqlState
impl UnwindSafe for SqlState
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