Ashley Mannix
7287d9ebd6
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
60ed7fbeeb
Merge pull request #225 from thiagoarrais/empty
...
Allows empty flag definition
2021-05-16 15:24:02 +10:00
Ashley Mannix
a9ae3b6400
Merge pull request #229 from bprosnitz/patch-1
...
Make from_bits a const fn
2021-05-11 11:03:18 +10:00
Ashley Mannix
6a03b95a46
Merge branch 'master' into empty
2021-05-11 11:01:55 +10:00
konsumlamm
ddd1151cde
Add test for bitflags! {}
2021-02-11 18:07:37 +01:00
Thiago Arrais
3c31f5fd7e
Allows empty flag definition
...
Fixes #179
2021-01-12 09:53:55 -03:00
konsumlamm
3ad1b4e099
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
9bd954bd9f
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
3f0b2e58c7
Let is_all() ignore extra bits ( fixes #208 )
2020-02-04 11:47:06 +01:00
Niklas Fiekas
40c89c1b39
Document from_bits_unchecked unsafety ( #200 )
2020-01-22 16:15:53 +01:00
Peter Todd
15a2a772aa
Fix typo ( #206 )
2020-01-01 14:32:36 +05:30
glts
0d8e9eb9d7
End empty doc comment with full stop ( #202 )
2019-12-03 17:22:44 +01:00
Ashley Mannix
71bd939054
Merge pull request #195 from varkor/1.2.1
...
Prepare for 1.2.1 release
2019-10-14 09:20:36 +10:00
varkor
c1d163ec23
Update to 1.2.1
2019-10-13 15:38:06 +01:00
varkor
a708b33223
Remove #[inline] on consts
2019-10-11 10:51:03 +01:00
Ashley Mannix
46e09e0528
prepare for 1.2.0 release
2019-09-23 13:21:36 +10:00
Michael Henry
a8c30bf570
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
b0a1bc1de4
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
1fa79a8ade
fix up unused item warning
2019-07-20 22:44:43 +10:00
Ashley Mannix
fa6b794e7b
fix up failing test and ensure it runs in CI
2019-07-20 22:41:17 +10:00
Shadlock0133
193679b9bb
Fix typo: {Lower, Upper}Exp - {Lower, Upper}Hex
2019-06-20 10:31:31 +02:00
Ashley Mannix
4c5af6a547
prepare for 1.1.0 release
2019-06-06 09:48:16 +10:00
Ashley Mannix
92064dc8f4
prepare for 1.0.5 release
2019-05-02 12:10:14 +10:00
Arturo Castro
c433cd1ffe
Merge branch 'master' of https://github.com/bitflags/bitflags into const_fn
2019-04-23 11:52:02 +02:00
Arturo Castro
9d755af839
const functions
...
This adds const functions for every non mutable function in the crate.
2019-04-23 11:50:28 +02:00
Anthony Ramine
28a380f1cb
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
bcd4f9aa64
Release 1.0.4
2018-08-21 15:54:08 -04:00
David Tolnay
7e23f08737
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
Ashley Mannix
e49746bf84
Update url refs to bitflags for new org ( #159 )
2018-05-31 19:16:13 +10:00
David Tolnay
d6ecddc78c
Release 1.0.3
2018-04-30 10:25:17 -07:00
David Tolnay
1af8460666
Format with rustfmt 0.6.0
2018-04-30 10:20:42 -07:00
Alex Addy
0f091d4b07
Improve zero flag handling and documentation.
2018-04-30 08:15:47 -04:00
David Tolnay
928920a5a8
Release 1.0.2
2018-04-25 19:36:19 -07:00
Hmvp
1ee9fb4b5e
Fix clippy lints
...
https://rust-lang-nursery.github.io/rust-clippy/v0.0.187/index.html#redundant_field_names
2018-03-06 15:19:39 +01:00
David Tolnay
0116999c94
Release 1.0.1
2017-11-12 08:02:47 -08:00
David Tolnay
7360d0bfa3
Merge pull request #136 from Amanieu/missing_inline
...
Adding missing #[inline]
2017-11-12 07:57:39 -08:00
Amanieu d'Antras
58a3e44af3
Add missing #[inline]
2017-11-12 15:40:31 +00:00
Gabriel Majeri
7f243bfad2
Add stable code for bitflags visibility
2017-11-08 07:36:16 +02:00
David Tolnay
8cc408dac4
Merge pull request #132 from rust-lang-nursery/align
...
Clean up excessive indentation
2017-10-22 14:54:45 -07:00
Tamir Duberstein
93e6f83eba
Generalize visibility handling
2017-10-22 17:26:49 -04:00
Tamir Duberstein
57afd42307
Remove unnecessary and confusing keywords
2017-10-22 17:26:49 -04:00
David Tolnay
35c3bca6f4
Clean up excessive indentation
...
I don't like this deliberately aligned, excessively indented style. It seems to
have fallen out of favor with rustfmt as well -- see their decision about
alignment of where-clauses.
2017-10-22 13:11:09 -07:00
David Tolnay
90fdabbb00
Compile and test the visibility example code
2017-10-22 12:48:07 -07:00
Amanieu d'Antras
146127c0a8
Change all the examples to avoid double-namespacing
2017-09-27 06:35:40 +01:00
Tamir Duberstein
7e93e84546
Clarify purpose of libcore re-export
2017-09-10 09:11:23 -04:00
Tamir Duberstein
fb9faae5f0
Remove stale rustbuild attrs
...
This attribute is no longer used in rustc's rustbuild.
2017-09-10 08:06:38 -04:00
Alex Crichton
a75ea3d71b
Bump to 1.0.0
2017-09-08 18:43:52 -07:00
Tamir Duberstein
53ad23bea6
Use associated constants
...
Fixes #20 .
Closes #21 .
2017-08-19 10:47:04 -07:00
David Tolnay
c68bced7a7
Support deprecated attribute on flags
2017-08-06 01:32:42 -07:00
afishberg
1671d93721
add missing method to crate documentation
...
added missing documentation for Flags struct's set method
2017-05-29 19:45:41 -04:00