Commit Graph

142 Commits

Author SHA1 Message Date
Ashley Mannix
8b7ad83d70
Update url refs to bitflags for new org (#159) 2018-05-31 19:16:13 +10:00
David Tolnay
e11d8c8f64
Release 1.0.3 2018-04-30 10:25:17 -07:00
David Tolnay
08167e663d
Format with rustfmt 0.6.0 2018-04-30 10:20:42 -07:00
Alex Addy
6b1bc88740 Improve zero flag handling and documentation. 2018-04-30 08:15:47 -04:00
David Tolnay
74aa397b0e
Release 1.0.2 2018-04-25 19:36:19 -07:00
David Tolnay
0f42a0085d
Revert example_generated::Flags to pub 2018-04-25 19:26:31 -07:00
David Tolnay
07a4252f25
Merge pull request #153 from hcpl/fix-examples
Fix the example `Flags` struct
2018-04-25 19:26:07 -07:00
hcpl
ce6c4462ab Fix the example Flags struct
So that it actually match the one in the crate level docs.
2018-04-09 23:54:01 +03:00
Hmvp
3ae42624f5 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
4b02847266
Release 1.0.1 2017-11-12 08:02:47 -08:00
David Tolnay
4afd947483
Merge pull request #136 from Amanieu/missing_inline
Adding missing #[inline]
2017-11-12 07:57:39 -08:00
Amanieu d'Antras
4954ea106b Add missing #[inline] 2017-11-12 15:40:31 +00:00
Gabriel Majeri
0ecb9f568f Add stable code for bitflags visibility 2017-11-08 07:36:16 +02:00
David Tolnay
8e163c64ec Merge pull request #132 from rust-lang-nursery/align
Clean up excessive indentation
2017-10-22 14:54:45 -07:00
Tamir Duberstein
f0853cbd5a
Generalize visibility handling 2017-10-22 17:26:49 -04:00
Tamir Duberstein
dea389434d
Remove unnecessary and confusing keywords 2017-10-22 17:26:49 -04:00
David Tolnay
fdfc321c84
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
c404e428ca
Compile and test the visibility example code 2017-10-22 12:48:07 -07:00
Amanieu d'Antras
bc3835aaf8 Change all the examples to avoid double-namespacing 2017-09-27 06:35:40 +01:00
Tamir Duberstein
612bac250a
Clarify purpose of libcore re-export 2017-09-10 09:11:23 -04:00
Tamir Duberstein
1a512cb8b2
Remove stale rustbuild attrs
This attribute is no longer used in rustc's rustbuild.
2017-09-10 08:06:38 -04:00
Alex Crichton
f5b70443ac Bump to 1.0.0 2017-09-08 18:43:52 -07:00
Tamir Duberstein
956a077d73
Use associated constants
Fixes #20.
Closes #21.
2017-08-19 10:47:04 -07:00
David Tolnay
944ee530cd
Support deprecated attribute on flags 2017-08-06 01:32:42 -07:00
afishberg
64f06a4bd1 add missing method to crate documentation
added missing documentation for Flags struct's set method
2017-05-29 19:45:41 -04:00
David Tolnay
20b2588f7d
Bump to 0.9.1 2017-05-29 09:07:19 -07:00
CensoredUsername
8c99399ff6 Prevent formatter trait impls from blowing up when other traits providing the .fmt method were brought into scope before the bitflags macro was invoked 2017-05-29 15:58:00 +02:00
Alex Crichton
172a5516cf Bump to 0.9.0 2017-05-21 08:48:31 -07:00
opilarium
c4be46dff1 Make clippy happy 2017-05-05 00:29:16 +03:00
Brian Anderson
d20d76e0e6 Merge pull request #99 from koivunej/example_generated
Example generated
2017-05-04 13:51:31 -07:00
robo9k
2619c01852 Add examples of deriving and implementing Default, fixes #66 2017-04-15 15:16:22 +02:00
Joonas Koivunen
c7c904e1c4 example_generated: add another note about demonstration purposes 2017-04-04 14:08:19 +03:00
Joonas Koivunen
65465a4be6 docs: link to example_generated below the example 2017-04-04 14:08:00 +03:00
Joonas Koivunen
5a14a7df49 guard example_generated with opt-out feature 2017-04-04 13:57:51 +03:00
Joonas Koivunen
c3b95543d1 example_generated: add an example for docs 2017-04-04 13:57:10 +03:00
Alex Crichton
b6846482ff Merge pull request #96 from Cldfire/move_docs
Move macro docs to the crate level
2017-04-01 15:38:59 -07:00
Cldfire
f4c6834f0a Update documentation links and attributes 2017-03-30 13:46:40 -04:00
Cldfire
d5b2b3913d Correct docs link and outdated doc syntax 2017-03-29 10:29:46 -04:00
Cldfire
223676f7ab Remove mention of now-stable feature 2017-03-29 09:54:18 -04:00
Cldfire
84d123cdd9 Move macro docs to crate level 2017-03-29 09:51:41 -04:00
Guillaume Gomez
2f42c1063b Fix the rustc feature 2017-03-24 17:31:52 +01:00
Alex Crichton
fc7a9fe685 Merge pull request #90 from topecongiro/hide-impl-macro
Hide impl implementation detail from bitflags! documentation
2017-03-24 09:57:58 -05:00
Alex Crichton
2d6b4468dc Merge pull request #88 from GuillaumeGomez/rust-buildchain
Make it able to build in the rust buildchain
2017-03-24 09:37:33 -05:00
Guillaume Gomez
7933b17858 Make it able to build in the rust buildchain 2017-03-24 11:36:18 +01:00
topecongiro
e1120f3834 Hide impl implementation detail from bitflags! documentation
Closes #63.
2017-03-24 15:02:26 +09:00
topecongiro
a3b8f94a27 Use semicolons instead of commas
Closes #65.
2017-03-24 09:32:11 +09:00
Alex Crichton
f02742c760 Fix merge conflict 2017-03-23 16:17:27 -07:00
Alex Crichton
9ecd74baa6 Merge pull request #86 from topecongiro/fmt
Implement Hex, Octal and Binary
2017-03-23 18:14:57 -05:00
Alex Crichton
c1e488dca2 Merge pull request #85 from crazymerlyn/debug_empty_flags
Modify Debug implementation to use "(empty)" instead of "" for empty flags
2017-03-23 18:14:31 -05:00
topecongiro
517080ae7d Implement Hex, Octal and Binary
Closes #82.
2017-03-23 01:28:12 +09:00
CrazyMerlyn
064dbbf3eb Modify Debug implementation to use "(empty)" instead of "" for empty flags 2017-03-22 17:45:12 +05:30
Vedant Rathore
f7da088eab Fix Issue #67
Changed flag keyword to struct
2017-03-21 06:31:50 +05:30
David Tolnay
46fd434725
Function-local bitflags 2017-03-07 18:03:56 -08:00
Alex Crichton
0de32c5d9c Merge pull request #62 from dtolnay/sip
Fix SipHasher deprecation in tests
2017-03-07 09:05:02 -06:00
David Tolnay
e90b6491b6
Fix SipHasher deprecation in tests 2017-03-06 20:23:50 -08:00
David Tolnay
b6912fb3b6
Remove i128 feature and conversions to u64 2017-03-06 20:12:18 -08:00
Alexander Stocko
f8065d0f9f Reverting to feature gated integer width for the macro formatting arm 2017-02-11 20:38:30 -05:00
Alexander Stocko
dc284a36ba Replace u64 with $T in the formatting macro. 2017-02-11 01:12:29 -05:00
Alexander Stocko
f98b06bf1a Revert "Add u128 feature for complete u128 compatibility"
This reverts commit 8ca48c881c.
2017-02-11 01:00:10 -05:00
Alexander Stocko
8ca48c881c Add u128 feature for complete u128 compatibility 2017-02-10 21:04:10 -05:00
Ryan Leckey
67e4485d20 Add .set method (condition-based insert/remove) 2016-12-22 00:54:32 -08:00
Alex Crichton
19cef12bd2 Add a test 2016-05-14 17:02:50 -07:00
David Hotham
a4704d2ade Again with #39
Don't have inner modules use a type that may only be available in outer
modules.
2016-05-14 14:47:43 +01:00
David Hotham
c25d6b4919 Fix for #39
Avoid definitions in inner modules being dependent on things that may
only be in scope in outer modules.
2016-05-13 20:05:13 +01:00
Kamal Marhubi
2e76c367ac Implement Extend for bitflags
This commit adds an `Extend` impl, and redefines the `FromIterator` impl
to use it.
2016-04-24 02:04:19 -04:00
John Ericson
3ad61057f5 no_std is stable 2016-04-20 13:03:36 -07:00
Matthew Dawson
b774494db9 Remove the assignment_operators feature, its requirements are now stable
With rust 1.8, augmented_assignments and op_assign_traits are stable.  Thus
just enable them globally.
2016-04-20 13:28:41 -04:00
Tamir Duberstein
1efde46dc7 Use assert_eq 2016-03-23 14:18:24 -04:00
Tamir Duberstein
17b72d7e4d Whitelist public reexport of std 2016-03-23 14:18:15 -04:00
Mika Attila
8ee77fd5f4 Apply suggestion of clippy if_not_else lint 2016-03-03 19:48:44 +01:00
Amanieu d'Antras
351a632bb0 Make bitflags private by default and add pub flags 2016-01-20 02:15:56 +00:00
Philipp Matthias Schaefer
206f9dfa94 Move assignment operators behind feature
Assignment operators can now be enabled using the crate feature
"assignment_operators".
2016-01-13 22:01:47 +01:00
Philipp Matthias Schaefer
266f020802 Implement assignment operators 2016-01-13 21:51:46 +01:00
Alex Crichton
11447b61f9 Merge pull request #33 from dimbleby/clean-clippy
Keep clippy happy
2016-01-12 08:48:18 -08:00
Amanieu d'Antras
bbea7ff88d Add support for no_std 2016-01-11 23:15:44 +00:00
David Hotham
9226d14be6 Keep clippy happy 2016-01-09 10:33:11 +00:00
Ms2ger
4a8a09cfaa Allow the methods on the generated struct to be unused. 2015-11-16 19:05:43 +01:00
Alex Crichton
96f21b5696 Add allow(dead_code) to inner modules
Closes #16
2015-07-05 11:03:12 -07:00
Alex Crichton
848f6f71e9 Touch up style and add some comments 2015-06-29 10:32:58 -07:00
Chris Morgan
4f12093b9c Make Debug fancy again and handle #[cfg] properly.
`Debug` was implemented using the nice readable flag names in #7, but
the flag names were removed in #9 because it used `$Flags` which broke
trivial `#[cfg]`-based removal of flags. Changing `.contains($Flag)` to
`.contains($BitFlags { bits: $value })` instead (akin to what `.all()`
did) would have fixed that issue, allowing a friendly `Debug` again, but
then I found a further improvement to make, because the `#[cfg]`
behaviour was still off, as a flag’s value was still written out
regardless of the `#[cfg]` attribute, so if *it* contained stuff that
didn’t exist `bitflags!` would still blow up. This is inconsistent with
how such things work in Rust proper, so I’ve fixed it.

The fix is rather convoluted, involving a dummy module, a bunch of dummy
constants, a nested function and glob imports, but it works, avoiding
referring to `$value` successfully. This change causes this to work:

```rust
bitflags! {
    flags Foo: u32 {
        #[cfg(a)]
        const A = 0b1,
        #[cfg(a)]
        const B = A.bits,  // or anything else that is `#[cfg(a)]`
    }
}
```

(Formerly `all()` was still trying to use `A.bits` when `cfg(not(a))`
and thus `A` wasn’t defined.)

This change allows `#[cfg]` on a flag to work like it should, allowing
it to depend on things that don’t exist unless the conditions are met.
Sure, that seems a pretty rare case for flags, but it’s real. Beyond
the style of example above, my imagined scenario is a -sys crate
having declared certain flag values, but only when certain features are
enabled, and so when defining the bitflags in another crate (for the
-sys crate doesn’t use bitflags) you can only use those values with the
appropriate features.
2015-06-26 13:13:25 +10:00
Chris Morgan
3ff9abcca7 Implement FromIterator on the flags struct.
I corrected some outdated information about the derived trait
implementations while I was at it.
2015-06-25 12:11:44 +10:00
Alex Crichton
1118315610 Don't impose widths and also add a test for #[cfg] 2015-06-01 13:35:50 -07:00
Jason Ozias
a88f42af5b re-implemented Debug to show the bits field of the internal struct as binary (8-bits wide) 2015-06-01 15:40:32 -04:00
Corey Richardson
133a3a4b2f Make a nice Debug impl for each bitflags.
This adds a Debug impl where previously there was none, so this is a

[breaking-change]
2015-05-31 03:31:09 -04:00
Alex Crichton
ec6b3b56c1 Move testing to stable 2015-05-16 22:12:35 -07:00
Alex Crichton
d228e58dbb Update to rust master 2015-03-25 09:00:17 -07:00
Alex Crichton
63be765b22 Update to rust master 2015-02-26 10:48:48 -08:00
Alex Crichton
bdb2a912ec Remove #![no_std] for now
This attribute is now feature gated.
2015-02-09 09:22:32 -08:00
doug
24eabcee83 Fixes the build by explicitly including libcore 2015-02-09 09:45:33 +08:00
Tobba
9841ccc174 Remove the (pointless) dependency on libstd 2015-01-19 10:26:03 +01:00
Alex Crichton
7f9d5ca72b Update doc examples 2015-01-15 00:33:51 -08:00
Alex Crichton
3b990f7272 Initial commit 2015-01-15 00:32:45 -08:00