specialize ConversionFlag (#42)

* specialize ConversionFlag

* Change value of ConversionFlag to i8 and None to -1

* is_* methods to ConversionFlag
This commit is contained in:
Jeong, YunWon 2023-05-16 22:52:50 +09:00 committed by GitHub
parent 611dcc2e9b
commit 9d47d3d212
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 60 additions and 104 deletions

View file

@ -13,6 +13,7 @@ ruff_text_size = { path = "../ruff_text_size" }
ruff_source_location = { path = "../ruff_source_location", optional = true }
serde = { version = "1.0.133", optional = true, default-features = false, features = ["derive"] }
is-macro.workspace = true
[features]
default = []

View file

@ -1,13 +1,13 @@
/// Transforms a value prior to formatting it.
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
#[repr(u8)]
#[derive(Copy, Clone, Debug, PartialEq, Eq, is_macro::Is)]
#[repr(i8)]
pub enum ConversionFlag {
/// No conversion
None = 0, // CPython uses -1 but not pleasure for us
None = -1, // CPython uses -1
/// Converts by calling `str(<value>)`.
Str = b's',
Str = b's' as i8,
/// Converts by calling `ascii(<value>)`.
Ascii = b'a',
Ascii = b'a' as i8,
/// Converts by calling `repr(<value>)`.
Repr = b'r',
Repr = b'r' as i8,
}