Commit Graph

142 Commits

Author SHA1 Message Date
KodrAus
54e47f7f4a prepare for 1.3.2 release 2021-08-16 14:12:11 +10:00
Luiz Carlos
93ce27cdea fix: allowed non_snake_case on trait impls
Fixes bitflags#237
2021-08-13 10:59:33 -03:00
Ashley Mannix
7b722c6751 prepare for 1.3.1 release 2021-08-12 13:07:45 +10:00
Ashley Mannix
64fe86ba51 add compile tests for common derives 2021-08-12 12:50:55 +10:00
Ashley Mannix
70c479748d reorganize crate tests 2021-08-12 11:05:35 +10:00
Taiki Endo
1536a2fdbe Remove #[repr(transparent)] 2021-08-12 08:27:04 +09:00
Ashley Mannix
ab6c459cb4 prepare for 1.3.0 release 2021-08-05 11:28:42 +10:00
Ashley Mannix
72a01b9e33 remove trailing comment 2021-08-05 11:07:15 +10:00
Ashley Mannix
c77191e53a add note about avoiding zero flags 2021-08-05 10:56:50 +10:00
konsumlamm
bef10f13ce Remove __bitflags_stringify! 2021-08-04 13:02:19 +02:00
konsumlamm
a6978d92f5 Use Self
Fix bug when overriding `stringify!`
2021-08-04 12:37:28 +02:00
Ashley Mannix
ec0fa76915
Merge pull request #244 from thomcc/setops
Add named functions to perform set operations
2021-08-04 08:50:27 +10:00
konsumlamm
75f7192557 Fix regression introduced in #246
Add test case
2021-07-19 16:24:15 +02:00
Ashley Mannix
efab7f3088
Merge pull request #187 from flier/repr_transparent
add #[repr(transparent)]
2021-07-19 10:37:02 +10:00
Ashley Mannix
46a2c8e72e
Merge pull request #246 from konsumlamm/modernization
Modernization
2021-07-19 10:07:43 +10:00
konsumlamm
ea8d102ba6 Don't reexport core 2021-06-27 20:10:26 +02:00
konsumlamm
27d1be19e5 Modernize imports 2021-06-27 20:00:43 +02:00
konsumlamm
66e11427aa Simplify bitflags! macro by using :vis 2021-06-27 17:53:48 +02:00
konsumlamm
39810e76f3 Fix typos 2021-06-26 21:42:01 +02:00
Thom Chiovoloni
a74e4577d5 Add named functions to perform set operations 2021-06-09 19:04:52 -07:00
Flier Lu
869ff95708 add #[repr(transparent)] for the the FFI layout 2021-05-20 11:16:17 +08:00
Ashley Mannix
bbd5d4dfb4 remove unneeded infra and dependence on compiler msgs 2021-05-16 20:08:13 +10:00
Ashley Mannix
ae4f46f187
Merge pull request #211 from niklasf/is-all-extra-bits
Let is_all() ignore extra bits (fixes #208)
2021-05-16 15:35:42 +10:00
Ashley Mannix
ec76dd2096
Merge pull request #225 from thiagoarrais/empty
Allows empty flag definition
2021-05-16 15:24:02 +10:00
Ashley Mannix
f356929dc3
Merge pull request #229 from bprosnitz/patch-1
Make from_bits a const fn
2021-05-11 11:03:18 +10:00
Ashley Mannix
6e93266858
Merge branch 'master' into empty 2021-05-11 11:01:55 +10:00
konsumlamm
380d3c0750 Add test for bitflags! {} 2021-02-11 18:07:37 +01:00
Thiago Arrais
3e4d47513a Allows empty flag definition
Fixes #179
2021-01-12 09:53:55 -03:00
konsumlamm
6bbbaabdbe Allow multiple bitflags structs in one macro invocation
Change mentions of the `flags` keyword (used before 0.9) to `struct`
2020-12-27 14:23:54 +01:00
Benjamin Prosnitz
c3fb4e64a8
Make from_bits a const fn
'if' now works in 'const fn as of rust 1.4.6 (https://blog.rust-lang.org/2020/08/27/Rust-1.46.0.html).

I would love to have 'from_bits' be a 'const fn' because it is the safest from_* function.
2020-10-19 16:58:51 -05:00
Niklas Fiekas
64379434f7 Let is_all() ignore extra bits (fixes #208) 2020-02-04 11:47:06 +01:00
Niklas Fiekas
e2270ecd39 Document from_bits_unchecked unsafety (#200) 2020-01-22 16:15:53 +01:00
Peter Todd
a755719edc Fix typo (#206) 2020-01-01 14:32:36 +05:30
glts
45a4703f5e End empty doc comment with full stop (#202) 2019-12-03 17:22:44 +01:00
Ashley Mannix
30668016ac
Merge pull request #195 from varkor/1.2.1
Prepare for 1.2.1 release
2019-10-14 09:20:36 +10:00
varkor
02f3bb6128 Update to 1.2.1 2019-10-13 15:38:06 +01:00
varkor
5853685623 Remove #[inline] on consts 2019-10-11 10:51:03 +01:00
Ashley Mannix
cde9cb6bd0 prepare for 1.2.0 release 2019-09-23 13:21:36 +10:00
Michael Henry
80fcb6a3b4 Adjust pull request based on feedback:
- Change `from_bits_unknown()` to the `unsafe` function
  `from_bits_unchecked()`.

- Eliminate unnecessary concept of "known" and "unknown" bits.
2019-08-03 09:11:18 -04:00
Michael Henry
8b9676ed35 Add support for "unknown" bits.
This allows bitflags to be robustly used in cases where bit flags are
defined outside the program and are subject to extension after the
program has been compiled.  In such cases, the new function
`from_bits_unknown()` can create a bitflags structure where some of the
stored bits have no pre-defined meaning to the program; nevertheless,
the program can store and manipulate them successfully rather than
mis-behaving.
2019-07-27 12:06:26 -04:00
Ashley Mannix
4e762d091e fix up unused item warning 2019-07-20 22:44:43 +10:00
Ashley Mannix
fc5f206eca fix up failing test and ensure it runs in CI 2019-07-20 22:41:17 +10:00
Shadlock0133
18243d37c5
Fix typo: {Lower, Upper}Exp - {Lower, Upper}Hex 2019-06-20 10:31:31 +02:00
Ashley Mannix
5384c5d5bd prepare for 1.1.0 release 2019-06-06 09:48:16 +10:00
Ashley Mannix
7ace11ae9e prepare for 1.0.5 release 2019-05-02 12:10:14 +10:00
Arturo Castro
907a53dda9 Merge branch 'master' of https://github.com/bitflags/bitflags into const_fn 2019-04-23 11:52:02 +02:00
Arturo Castro
d038a14537 const functions
This adds const functions for every non mutable function in the crate.
2019-04-23 11:50:28 +02:00
Anthony Ramine
5580478557 Put the user-provided attributes first
`#[derive]` should always come after any proc macro attribute.
2019-03-14 11:50:34 +01:00
David Tolnay
518aaf9149
Release 1.0.4 2018-08-21 15:54:08 -04:00
David Tolnay
e72681e4fa
Use local_inner_macros to resolve all helper macros within $crate
This fixes the following error when using Rust 2018 style macro imports.

    use bitflags::bitflags;

    error: cannot find macro `__bitflags!` in this scope
      --> src/main.rs:5:1
       |
    5  | / bitflags! {
    6  | |     struct Flags: u32 {
    7  | |         const A = 0b00000001;
    8  | |         const B = 0b00000010;
    ...  |
    11 | |     }
    12 | | }
       | |_^ help: you could try the macro: `bitflags`
       |

The `local_inner_macros` modifier resolves all macro invocations made
from within that macro as helpers in the same crate. So if `bitflags!`
expands to an invocation of `__bitflags!` then this would be resolved as
`$crate::__bitflags!` rather than requiring the caller to have
`__bitflags` in scope.

The attribute is ignored by pre-2018 compilers so bitflags will continue
to work as normal with #[macro_use].

In the future when dropping compatibility with pre-2018 compilers we can
remove the `local_inner_macros` modifier and use our own explicit
`$crate::` prefixes on invocations of helper macros.
2018-07-26 09:58:34 -07:00