rel-ptr 0.2.3

A tool for building movable self-referential types
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use super::*;

use std::fmt::*;

impl<T: ?Sized + MetaData, I: Debug + Delta> Pointer for RelPtr<T, I> {
    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
        write!(f, "{:p}({:?})", self, self.0)
    }
}

impl<T: ?Sized + MetaData, I: Debug + Delta> Debug for RelPtr<T, I> {
    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
        f.debug_struct("RelPtr")
            .field("ptr", &(self as *const Self))
            .field("offset", &self.0)
            .finish()
    }
}