[][src]Trait reffers::rc::BitMask

pub unsafe trait BitMask: Copy + Default {
    type Num: Copy + Default + BitAnd<Output = Self::Num> + PartialEq + Add<Output = Self::Num> + Sub<Output = Self::Num> + From<u8> + Not<Output = Self::Num>;

    const SHIFTED: [Self::Num; 4];
    const MASKS: [Self::Num; 4];

    fn get_inner(&self) -> Self::Num;
fn set_inner(&mut self, v: Self::Num);
fn get_state(&self) -> u8;
fn set_state(&mut self, v: u8); }

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.

Loading content...

Associated Constants

const SHIFTED: [Self::Num; 4]

All zero bits, except for the first bit

const MASKS: [Self::Num; 4]

Transforms bits into masks.

Loading content...

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.

Loading content...

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

impl BitMask for u16[src]

Using u16 will allow for a maximum of 32 Ref, 16 Strong and 32 Weak.

type Num = u16

impl BitMask for u32[src]

Using u32 will allow for a maximum of 1024 Ref, 1024 Strong and 1024 Weak.

type Num = u32

impl BitMask for usize[src]

Usize defaults to same as u32.

type Num = usize

impl BitMask for u64[src]

Using u64 will allow for a maximum of 2097152 Ref, 1048576 Strong and 2097152 Weak.

type Num = u64

impl BitMask for u128[src]

Using u128 will give you 42 bits of Ref, Strong and Weak.

type Num = u128

Loading content...

Implementors

Loading content...