o3 0.62.0

shared-nothing primitives
Documentation
//! Compile-time representation of retained-owner evidence.

use crate::buffer::hold;

/// Selects the exact stored representation of retained-owner evidence.
pub trait Mode {
    const ENABLED: bool;
    type Projection: Copy + Default + From<hold::Charge>;
}

/// Erases retained-owner evidence and its storage from a monomorphization.
#[derive(Clone, Copy, Default)]
pub struct Off;

impl Mode for Off {
    const ENABLED: bool = false;
    type Projection = [hold::Charge; 0];
}

/// Preserves the exact physical-owner charge for evidence delivery.
pub enum On {}

impl Mode for On {
    const ENABLED: bool = true;
    type Projection = [hold::Charge; 1];
}

const _: () = {
    assert!(core::mem::size_of::<<Off as Mode>::Projection>() == 0);
    assert!(
        core::mem::size_of::<<On as Mode>::Projection>() == core::mem::size_of::<hold::Charge>()
    );
};