mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-22 16:29:20 +08:00
Add #[non_exhaustive]
to enums that might get new variants. (#673)
This just using them in patterns without a catchall. I left things alone that seem very unlikely to change (`Value`, `ValueRef`, `DatabaseName`, etc...). This might help reduce the number of breaking changes we need (rusqlite is still pre-1.0 so it doesn't really matter that much, but breaking changes complicate the story around when we can cut releases).
This commit is contained in:
parent
3196989f0d
commit
6f6f7ffd9f
@ -4,6 +4,7 @@ use std::os::raw::c_int;
|
||||
|
||||
/// Error Codes
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
#[non_exhaustive]
|
||||
pub enum ErrorCode {
|
||||
/// Internal logic error in SQLite
|
||||
InternalMalfunction,
|
||||
|
@ -17,6 +17,7 @@ pub fn SQLITE_TRANSIENT() -> sqlite3_destructor_type {
|
||||
|
||||
/// Run-Time Limit Categories
|
||||
#[repr(i32)]
|
||||
#[non_exhaustive]
|
||||
pub enum Limit {
|
||||
/// The maximum size of any string or BLOB or table row, in bytes.
|
||||
SQLITE_LIMIT_LENGTH = SQLITE_LIMIT_LENGTH,
|
||||
|
@ -132,6 +132,7 @@ impl Connection {
|
||||
|
||||
/// `feature = "backup"` Possible successful results of calling `Backup::step`.
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||
#[non_exhaustive]
|
||||
pub enum StepResult {
|
||||
/// The backup is complete.
|
||||
Done,
|
||||
|
@ -8,6 +8,7 @@ use crate::{Connection, Result};
|
||||
/// Database Connection Configuration Options
|
||||
#[repr(i32)]
|
||||
#[allow(non_snake_case, non_camel_case_types)]
|
||||
#[non_exhaustive]
|
||||
pub enum DbConfig {
|
||||
//SQLITE_DBCONFIG_MAINDBNAME = 1000, /* const char* */
|
||||
//SQLITE_DBCONFIG_LOOKASIDE = 1001, /* void* int int */
|
||||
|
@ -10,6 +10,7 @@ use std::str;
|
||||
/// Enum listing possible errors from rusqlite.
|
||||
#[derive(Debug)]
|
||||
#[allow(clippy::enum_variant_names)]
|
||||
#[non_exhaustive]
|
||||
pub enum Error {
|
||||
/// An error from an underlying SQLite call.
|
||||
SqliteFailure(ffi::Error, Option<String>),
|
||||
|
@ -12,6 +12,7 @@ use crate::{Connection, InnerConnection};
|
||||
/// `feature = "hooks"` Action Codes
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
#[repr(i32)]
|
||||
#[non_exhaustive]
|
||||
pub enum Action {
|
||||
UNKNOWN = -1,
|
||||
SQLITE_DELETE = ffi::SQLITE_DELETE,
|
||||
|
@ -638,6 +638,7 @@ impl Connection {
|
||||
/// `feature = "session"` Constants passed to the conflict handler
|
||||
#[repr(i32)]
|
||||
#[derive(Debug, PartialEq)]
|
||||
#[non_exhaustive]
|
||||
pub enum ConflictType {
|
||||
UNKNOWN = -1,
|
||||
SQLITE_CHANGESET_DATA = ffi::SQLITE_CHANGESET_DATA,
|
||||
@ -662,6 +663,7 @@ impl From<i32> for ConflictType {
|
||||
/// `feature = "session"` Constants returned by the conflict handler
|
||||
#[repr(i32)]
|
||||
#[derive(Debug, PartialEq)]
|
||||
#[non_exhaustive]
|
||||
pub enum ConflictAction {
|
||||
SQLITE_CHANGESET_OMIT = ffi::SQLITE_CHANGESET_OMIT,
|
||||
SQLITE_CHANGESET_REPLACE = ffi::SQLITE_CHANGESET_REPLACE,
|
||||
|
@ -822,6 +822,7 @@ impl Statement<'_> {
|
||||
/// may not be available.
|
||||
#[repr(i32)]
|
||||
#[derive(Clone, Copy, PartialEq, Eq)]
|
||||
#[non_exhaustive]
|
||||
pub enum StatementStatus {
|
||||
/// Equivalent to SQLITE_STMTSTATUS_FULLSCAN_STEP
|
||||
FullscanStep = 1,
|
||||
|
@ -4,6 +4,7 @@ use std::ops::Deref;
|
||||
/// Options for transaction behavior. See [BEGIN
|
||||
/// TRANSACTION](http://www.sqlite.org/lang_transaction.html) for details.
|
||||
#[derive(Copy, Clone)]
|
||||
#[non_exhaustive]
|
||||
pub enum TransactionBehavior {
|
||||
Deferred,
|
||||
Immediate,
|
||||
@ -12,6 +13,7 @@ pub enum TransactionBehavior {
|
||||
|
||||
/// Options for how a Transaction or Savepoint should behave when it is dropped.
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||
#[non_exhaustive]
|
||||
pub enum DropBehavior {
|
||||
/// Roll back the changes. This is the default.
|
||||
Rollback,
|
||||
|
@ -4,6 +4,7 @@ use std::fmt;
|
||||
|
||||
/// Enum listing possible errors from `FromSql` trait.
|
||||
#[derive(Debug)]
|
||||
#[non_exhaustive]
|
||||
pub enum FromSqlError {
|
||||
/// Error when an SQLite value is requested, but the type of the result
|
||||
/// cannot be converted to the requested Rust type.
|
||||
|
@ -7,6 +7,7 @@ use std::borrow::Cow;
|
||||
/// `ToSqlOutput` represents the possible output types for implementors of the
|
||||
/// `ToSql` trait.
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[non_exhaustive]
|
||||
pub enum ToSqlOutput<'a> {
|
||||
/// A borrowed SQLite-representable value.
|
||||
Borrowed(ValueRef<'a>),
|
||||
|
@ -247,6 +247,7 @@ pub trait CreateVTab: VTab {
|
||||
/// `feature = "vtab"` Index constraint operator.
|
||||
#[derive(Debug, PartialEq)]
|
||||
#[allow(non_snake_case, non_camel_case_types)]
|
||||
#[non_exhaustive]
|
||||
pub enum IndexConstraintOp {
|
||||
SQLITE_INDEX_CONSTRAINT_EQ,
|
||||
SQLITE_INDEX_CONSTRAINT_GT,
|
||||
|
Loading…
Reference in New Issue
Block a user