#[repr(u8)]
pub enum Category {
    Success,
    Warning,
    NoData,
    Exception,
}
Expand description

A general category for a given SQLSTATE code.

The conditions Success and NoData are normally hidden by database driver abstractions.

Variants§

§

Success

Category S: Successful completion.

§

Warning

Category W: Successful completion with a warning.

§

NoData

Category N: No data / empty result.

§

Exception

Category X: Exceptional condition.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Converts the Category into the corresponding category abbrevation character.

let success = SqlState("00000");
let category = success.category();
assert_eq!(char::from(category), 'S');

Converts the Category into the corresponding ASCII byte character.

let no_data = SqlState("02000");
let category = no_data.category();
assert_eq!(u8::from(category), b'N');
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Constructs a Category from a category abbrevation character.

let category: Category = 'X'.try_into()?;
The type returned in the event of a conversion error.

Constructs a Category from an ASCII byte character.

let category: Category = b'X'.try_into()?;
The type returned in the event of a conversion error.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.