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); }
Expand description

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

The internal primitive type, usually u8, u16, u32 or u64.

Associated Constants

All zero bits, except for the first bit

Transforms bits into masks.

Required methods

Gets the bitmask

Sets the bitmask to the specified value.

Gets the two lowest bits.

Sets the two lowest bits.

Implementations on Foreign Types

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.

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

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

Usize defaults to same as u32.

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

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

Implementors