pub trait GhostBorrow<'a, 'brand> {
    type Result;

    fn borrow(self, token: &'a GhostToken<'brand>) -> Self::Result;
}
Expand description

A trait for implementing multiple borrows for any number of arguments, using a GhostToken<'a, 'brand>.

Implemented for a mixture of tuple and array types.

Required Associated Types

The references you get as a result.

For example, if Self is (&'a GhostCell<'brand, T0>, &'a GhostCell<'brand, T1>) then Result is (&'a T0, &'a T1).

Required Methods

Borrows any number of GhostCells at the same time.

Example
use ghost_cell::{GhostToken, GhostCell, GhostBorrow};

let value = GhostToken::new(|mut token| {
    let cell1 = GhostCell::new(42);
    let cell2 = GhostCell::new(47);

    let (reference1, reference2): (&i32, &i32) = (&cell1, &cell2).borrow(&token);

    (*reference1, *reference2)
});

assert_eq!((42, 47), value);

Implementations on Foreign Types

Implementors