Common trait to access data related to specified substruct

This commit is contained in:
Andrew Golovashevich 2026-01-08 22:55:02 +03:00
parent bc1da406e6
commit a133d5e187
2 changed files with 13 additions and 1 deletions

View File

@ -1,4 +1,5 @@
mod node_ref;
// mod links_offset;
mod links;
pub use node_ref::*;
pub use links::*;

11
src/links.rs Normal file
View 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;
}