From 68c3083e34ef848b6d59166b3079ee5c6497175c Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Sun, 24 Dec 2023 02:54:48 -0500 Subject: [PATCH] Add `#[derive(Clone, Copy...` on some bitflags / enum (#1396) This will make it easier to use them, e.g. I won't need to re-create `FunctionFlags` for registering multiple similar functions. --- src/config.rs | 1 + src/functions.rs | 1 + src/limits.rs | 1 + src/types/mod.rs | 2 +- src/vtab/mod.rs | 1 + 5 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/config.rs b/src/config.rs index 194ee5963..1c2220cc0 100644 --- a/src/config.rs +++ b/src/config.rs @@ -9,6 +9,7 @@ use crate::{Connection, Result}; /// Database Connection Configuration Options /// See [Database Connection Configuration Options](https://sqlite.org/c3ref/c_dbconfig_enable_fkey.html) for details. #[repr(i32)] +#[derive(Copy, Clone, Debug)] #[allow(non_snake_case, non_camel_case_types)] #[non_exhaustive] #[allow(clippy::upper_case_acronyms)] diff --git a/src/functions.rs b/src/functions.rs index 522f1167d..576d1b0a7 100644 --- a/src/functions.rs +++ b/src/functions.rs @@ -311,6 +311,7 @@ bitflags::bitflags! { /// Function Flags. /// See [sqlite3_create_function](https://sqlite.org/c3ref/create_function.html) /// and [Function Flags](https://sqlite.org/c3ref/c_deterministic.html) for details. + #[derive(Clone, Copy, Debug)] #[repr(C)] pub struct FunctionFlags: ::std::os::raw::c_int { /// Specifies UTF-8 as the text encoding this SQL function prefers for its parameters. diff --git a/src/limits.rs b/src/limits.rs index d0694e304..f61b2b8c5 100644 --- a/src/limits.rs +++ b/src/limits.rs @@ -9,6 +9,7 @@ use std::os::raw::c_int; /// See the official documentation for more information: /// - /// - +#[derive(Copy, Clone, Debug)] #[repr(i32)] #[non_exhaustive] #[allow(clippy::upper_case_acronyms, non_camel_case_types)] diff --git a/src/types/mod.rs b/src/types/mod.rs index 4dbc19dd9..97059a370 100644 --- a/src/types/mod.rs +++ b/src/types/mod.rs @@ -111,7 +111,7 @@ pub struct Null; /// SQLite data types. /// See [Fundamental Datatypes](https://sqlite.org/c3ref/c_blob.html). -#[derive(Clone, Debug, PartialEq, Eq)] +#[derive(Copy, Clone, Debug, PartialEq, Eq)] pub enum Type { /// NULL Null, diff --git a/src/vtab/mod.rs b/src/vtab/mod.rs index 7e2f5f54f..4ee1693d0 100644 --- a/src/vtab/mod.rs +++ b/src/vtab/mod.rs @@ -373,6 +373,7 @@ bitflags::bitflags! { /// Virtual table scan flags /// See [Function Flags](https://sqlite.org/c3ref/c_index_scan_unique.html) for details. #[repr(C)] + #[derive(Copy, Clone, Debug)] pub struct IndexFlags: ::std::os::raw::c_int { /// Default const NONE = 0;