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
11 changed files with 39 additions and 29 deletions

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)]