mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
Rename macros crate to plugins
This commit is contained in:
parent
6177a3bdcc
commit
fcb25a35ec
13 changed files with 113 additions and 74 deletions
20
components/plugins/macros.rs
Normal file
20
components/plugins/macros.rs
Normal file
|
@ -0,0 +1,20 @@
|
|||
//! Exports macros for use in other Servo crates.
|
||||
|
||||
#[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 }))
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue