mirror of
https://github.com/Noratrieb/stuff.git
synced 2026-01-15 17:05:08 +01:00
add pointer tag
This commit is contained in:
parent
3209133840
commit
c54e5531aa
3 changed files with 18 additions and 2 deletions
17
src/tag.rs
Normal file
17
src/tag.rs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
use core::marker::PhantomData;
|
||||
|
||||
use crate::Backend;
|
||||
|
||||
pub struct TaggedPtr<T, S, B = usize>(B::Stored, PhantomData<S>)
|
||||
where
|
||||
B: Backend<T>;
|
||||
|
||||
pub trait TaggingStrategy<B> {
|
||||
type Tag;
|
||||
|
||||
fn get_tag(data: B) -> Self::Tag;
|
||||
|
||||
fn get_ptr_addr(data: B) -> usize;
|
||||
|
||||
fn set(addr: usize, tag: Self::Tag) -> B;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue