[−][src]Trait reffers::rc::BitMask
The BitMask trait configures the memory overhead and the number of bits for Ref, Strong and Weak references.
If you like to make your own, use the rc_bit_mask!
macro.
Associated Types
type Num: Copy + Default + BitAnd<Output = Self::Num> + PartialEq + Add<Output = Self::Num> + Sub<Output = Self::Num> + From<u8> + Not<Output = Self::Num>
The internal primitive type, usually u8, u16, u32 or u64.
Associated Constants
const SHIFTED: [Self::Num; 4]
All zero bits, except for the first bit
const MASKS: [Self::Num; 4]
Transforms bits into masks.
Required methods
fn get_inner(&self) -> Self::Num
Gets the bitmask
fn set_inner(&mut self, v: Self::Num)
Sets the bitmask to the specified value.
fn get_state(&self) -> u8
Gets the two lowest bits.
fn set_state(&mut self, v: u8)
Sets the two lowest bits.
Implementations on Foreign Types
impl BitMask for u8
[src]
Using u8 will allow for a maximum of four Ref, four Strong and four Weak.
That's not much, maybe you want to implement your own wrapper type instead.
type Num = u8
const SHIFTED: [u8; 4]
[src]
const MASKS: [u8; 4]
[src]
fn get_state(&self) -> u8
[src]
fn set_state(&mut self, v: u8)
[src]
fn get_inner(&self) -> Self::Num
[src]
fn set_inner(&mut self, v: Self::Num)
[src]
impl BitMask for u16
[src]
Using u16 will allow for a maximum of 32 Ref, 16 Strong and 32 Weak.
type Num = u16
const SHIFTED: [u16; 4]
[src]
const MASKS: [u16; 4]
[src]
fn get_state(&self) -> u8
[src]
fn set_state(&mut self, v: u8)
[src]
fn get_inner(&self) -> Self::Num
[src]
fn set_inner(&mut self, v: Self::Num)
[src]
impl BitMask for u32
[src]
Using u32 will allow for a maximum of 1024 Ref, 1024 Strong and 1024 Weak.
type Num = u32
const SHIFTED: [u32; 4]
[src]
const MASKS: [u32; 4]
[src]
fn get_state(&self) -> u8
[src]
fn set_state(&mut self, v: u8)
[src]
fn get_inner(&self) -> Self::Num
[src]
fn set_inner(&mut self, v: Self::Num)
[src]
impl BitMask for usize
[src]
Usize defaults to same as u32.
type Num = usize
const SHIFTED: [usize; 4]
[src]
const MASKS: [usize; 4]
[src]
fn get_state(&self) -> u8
[src]
fn set_state(&mut self, v: u8)
[src]
fn get_inner(&self) -> Self::Num
[src]
fn set_inner(&mut self, v: Self::Num)
[src]
impl BitMask for u64
[src]
Using u64 will allow for a maximum of 2097152 Ref, 1048576 Strong and 2097152 Weak.
type Num = u64
const SHIFTED: [u64; 4]
[src]
const MASKS: [u64; 4]
[src]
fn get_state(&self) -> u8
[src]
fn set_state(&mut self, v: u8)
[src]
fn get_inner(&self) -> Self::Num
[src]
fn set_inner(&mut self, v: Self::Num)
[src]
impl BitMask for u128
[src]
Using u128 will give you 42 bits of Ref, Strong and Weak.