Remove bitfield! macro in favour of bitflags!

This commit is contained in:
Claes 'Letharion' Gyllensvärd 2014-11-16 14:39:16 +01:00
parent 64cc9ec688
commit 2737db3ad7
10 changed files with 146 additions and 175 deletions

View file

@ -35,7 +35,6 @@ use syntax::parse::token::intern;
pub mod jstraceable;
pub mod lints;
mod macros;
#[plugin_registrar]
pub fn plugin_registrar(reg: &mut Registry) {
reg.register_syntax_extension(intern("dom_struct"), Modifier(box jstraceable::expand_dom_struct));

View file

@ -1,22 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#[macro_export]
macro_rules! bitfield(
($bitfieldname:ident, $getter:ident, $setter:ident, $value:expr) => (
impl $bitfieldname {
#[inline]
pub fn $getter(self) -> bool {
let $bitfieldname(this) = self;
(this & $value) != 0
}
#[inline]
pub fn $setter(&mut self, value: bool) {
let $bitfieldname(this) = *self;
*self = $bitfieldname((this & !$value) | (if value { $value } else { 0 }))
}
}
)
)