Update bitflags to v2 (#2564)

This commit is contained in:
Paolo Barbolini 2023-06-30 21:34:33 +02:00 committed by GitHub
parent 713da5b7b0
commit 37fdc2043b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 39 additions and 29 deletions

29
Cargo.lock generated
View File

@ -273,6 +273,15 @@ version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
version = "2.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6dbe3c979c178231552ecba20214a8272df4e09f232a87aef4320cf06539aded"
dependencies = [
"serde",
]
[[package]]
name = "block-buffer"
version = "0.10.2"
@ -491,7 +500,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69c5a7f9997be616e47f0577ee38c91decb33392c5be4866494f34cdf329a9aa"
dependencies = [
"atty",
"bitflags",
"bitflags 1.3.2",
"clap_derive",
"clap_lex",
"indexmap 1.9.3",
@ -1512,7 +1521,7 @@ version = "0.23.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f866317acbd3a240710c63f065ffb1e4fd466259045ccb504130b7f668f35c6"
dependencies = [
"bitflags",
"bitflags 1.3.2",
"cc",
"cfg-if",
"libc",
@ -1616,7 +1625,7 @@ version = "0.10.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "618febf65336490dfcf20b73f885f5651a0c89c64c2d4a8c3662585a70bf5bd0"
dependencies = [
"bitflags",
"bitflags 1.3.2",
"cfg-if",
"foreign-types",
"libc",
@ -2024,7 +2033,7 @@ version = "0.2.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42"
dependencies = [
"bitflags",
"bitflags 1.3.2",
]
[[package]]
@ -2170,7 +2179,7 @@ version = "0.35.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d51cc38aa10f6bbb377ed28197aa052aa4e2b762c22be9d3153d01822587e787"
dependencies = [
"bitflags",
"bitflags 1.3.2",
"errno",
"io-lifetimes",
"libc",
@ -2214,7 +2223,7 @@ version = "9.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db7826789c0e25614b03e5a54a0717a86f9ff6e6e5247f92b369472869320039"
dependencies = [
"bitflags",
"bitflags 1.3.2",
"cfg-if",
"clipboard-win",
"dirs-next",
@ -2291,7 +2300,7 @@ version = "2.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dc14f172faf8a0194a3aded622712b0de276821addc574fa54fc0a1167e10dc"
dependencies = [
"bitflags",
"bitflags 1.3.2",
"core-foundation",
"core-foundation-sys",
"libc",
@ -2512,7 +2521,6 @@ dependencies = [
"atoi",
"bigdecimal",
"bit-vec",
"bitflags",
"bstr",
"byteorder",
"bytes",
@ -2607,7 +2615,7 @@ dependencies = [
"atoi",
"base64 0.21.0",
"bigdecimal",
"bitflags",
"bitflags 2.3.2",
"byteorder",
"bytes",
"chrono",
@ -2653,7 +2661,7 @@ dependencies = [
"base64 0.21.0",
"bigdecimal",
"bit-vec",
"bitflags",
"bitflags 2.3.2",
"byteorder",
"chrono",
"crc",
@ -2696,7 +2704,6 @@ name = "sqlx-sqlite"
version = "0.7.0-alpha.3"
dependencies = [
"atoi",
"bitflags",
"chrono",
"flume",
"futures-channel",

View File

@ -54,7 +54,6 @@ paste = "1.0.6"
ahash = "0.8"
atoi = "2.0"
bitflags = { version = "1.3.2", default-features = false }
bytes = "1.1.0"
byteorder = { version = "1.4.3", default-features = false, features = ["std"] }
chrono = { version = "0.4.19", default-features = false, features = ["clock"], optional = true }

View File

@ -45,7 +45,7 @@ uuid = { workspace = true, optional = true }
# Misc
atoi = "2.0"
base64 = { version = "0.21.0", default-features = false, features = ["std"] }
bitflags = { version = "1.3.2", default-features = false }
bitflags = { version = "2", default-features = false, features = ["serde"] }
byteorder = { version = "1.4.3", default-features = false, features = ["std"] }
bytes = "1.1.0"
dotenvy = "0.15.5"

View File

@ -1,6 +1,7 @@
// https://dev.mysql.com/doc/dev/mysql-server/8.0.12/group__group__cs__capabilities__flags.html
// https://mariadb.com/kb/en/library/connection/#capabilities
bitflags::bitflags! {
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct Capabilities: u64 {
// [MariaDB] MySQL compatibility
const MYSQL = 1;

View File

@ -1,6 +1,7 @@
// https://dev.mysql.com/doc/dev/mysql-server/8.0.12/mysql__com_8h.html#a1d854e841086925be1883e4d7b4e8cad
// https://mariadb.com/kb/en/library/mariadb-connectorc-types-and-definitions/#server-status
bitflags::bitflags! {
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct Status: u16 {
// Is raised when a multi-statement transaction has been started, either explicitly,
// by means of BEGIN or COMMIT AND CHAIN, or implicitly, by the first

View File

@ -12,6 +12,7 @@ use crate::protocol::Capabilities;
bitflags! {
#[cfg_attr(feature = "offline", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub(crate) struct ColumnFlags: u16 {
/// Field can't be `NULL`.
const NOT_NULL = 1;

View File

@ -48,7 +48,7 @@ uuid = { workspace = true, optional = true }
# Misc
atoi = "2.0"
base64 = { version = "0.21.0", default-features = false, features = ["std"] }
bitflags = { version = "1.3.2", default-features = false }
bitflags = { version = "2", default-features = false }
byteorder = { version = "1.4.3", default-features = false, features = ["std"] }
dotenvy = { workspace = true }
hex = "0.4.3"

View File

@ -166,6 +166,7 @@ impl<'r> Decode<'r, Postgres> for PgLQuery {
bitflags! {
/// Modifiers that can be set to non-star labels
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct PgLQueryVariantFlag: u16 {
/// * - Match any label with this prefix, for example foo* matches foobar
const ANY_END = 0x01;
@ -263,7 +264,7 @@ impl FromStr for PgLQueryVariant {
fn from_str(s: &str) -> Result<Self, Self::Err> {
let mut label_length = s.len();
let mut rev_iter = s.bytes().rev();
let mut modifiers = PgLQueryVariantFlag { bits: 0 };
let mut modifiers = PgLQueryVariantFlag::empty();
while let Some(b) = rev_iter.next() {
match b {

View File

@ -13,16 +13,17 @@ use crate::{PgArgumentBuffer, PgHasArrayType, PgTypeInfo, PgValueFormat, PgValue
// https://github.com/postgres/postgres/blob/2f48ede080f42b97b594fb14102c82ca1001b80c/src/include/utils/rangetypes.h#L35-L44
bitflags! {
struct RangeFlags: u8 {
const EMPTY = 0x01;
const LB_INC = 0x02;
const UB_INC = 0x04;
const LB_INF = 0x08;
const UB_INF = 0x10;
const LB_NULL = 0x20; // not used
const UB_NULL = 0x40; // not used
const CONTAIN_EMPTY = 0x80; // internal
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
struct RangeFlags: u8 {
const EMPTY = 0x01;
const LB_INC = 0x02;
const UB_INC = 0x04;
const LB_INF = 0x08;
const UB_INF = 0x10;
const LB_NULL = 0x20; // not used
const UB_NULL = 0x40; // not used
const CONTAIN_EMPTY = 0x80; // internal
}
}
#[derive(Debug, PartialEq, Eq, Clone)]

View File

@ -16,7 +16,7 @@ json = ["sqlx-core/json", "serde"]
offline = ["sqlx-core/offline", "serde"]
migrate = ["sqlx-core/migrate"]
chrono = ["dep:chrono", "bitflags"]
chrono = ["dep:chrono"]
regexp = ["dep:regex"]
[dependencies]
@ -31,8 +31,6 @@ chrono = { workspace = true, optional = true }
time = { workspace = true, optional = true }
uuid = { workspace = true, optional = true }
bitflags = { version = "1.3.2", optional = true }
url = { version = "2.2.2", default-features = false }
percent-encoding = "2.1.0"

View File

@ -1,3 +1,5 @@
use std::fmt::Display;
use crate::value::ValueRef;
use crate::{
decode::Decode,
@ -7,7 +9,6 @@ use crate::{
types::Type,
Sqlite, SqliteArgumentValue, SqliteTypeInfo, SqliteValueRef,
};
use bitflags::_core::fmt::Display;
use chrono::FixedOffset;
use chrono::{
DateTime, Local, NaiveDate, NaiveDateTime, NaiveTime, Offset, SecondsFormat, TimeZone, Utc,