dope-core 0.75.0

Owned native I/O and completion driver for dope
Documentation
use std::{mem, pin::Pin};

use crate::driver::{storage, storage::Path};

/// Projects both fields of a pinned tuple storage output.
pub fn split<A, B>(pair: Pin<&(A, B)>) -> (Pin<&A>, Pin<&B>) {
    let (first, second) = pair.get_ref();
    // SAFETY: the pinned tuple owns both fields in place and drops each there.
    unsafe { (Pin::new_unchecked(first), Pin::new_unchecked(second)) }
}

/// The path from a storage plan to itself.
#[derive(Clone, Copy, Default)]
pub struct Here;

impl<S: storage::Plan> Path<S, S> for Here {
    fn get<'life, 'p, 'd>(self, root: &'life S::Output<'p, 'd>) -> &'life S::Output<'p, 'd>
    where
        'd: 'p,
        'p: 'life,
        'd: 'life,
        Self: 'd,
        S: 'd,
    {
        root
    }
}

const _: () = {
    assert!(mem::size_of::<Here>() == 0);
    assert!(mem::align_of::<Here>() == 1);
    assert!(!mem::needs_drop::<Here>());
};