Common trait to access data related to specified substruct
This commit is contained in:
parent
bc1da406e6
commit
a133d5e187
@ -1,4 +1,5 @@
|
|||||||
mod node_ref;
|
mod node_ref;
|
||||||
// mod links_offset;
|
mod links;
|
||||||
|
|
||||||
pub use node_ref::*;
|
pub use node_ref::*;
|
||||||
|
pub use links::*;
|
||||||
|
|||||||
11
src/links.rs
Normal file
11
src/links.rs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
pub trait LinkedStructLinksTypeProvider {
|
||||||
|
type Links: Sized;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub trait LinkedStructLinksOffset: LinkedStructLinksTypeProvider {
|
||||||
|
type Node;
|
||||||
|
|
||||||
|
fn getLinks<R>(nodeRef: &Self::Node, consumer: impl FnOnce(&Self::Links) -> R) -> R;
|
||||||
|
|
||||||
|
fn getLinksMut<R>(nodeRef: &mut Self::Node, consumer: impl FnOnce(&mut Self::Links) -> R) -> R;
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user