Redesigned 'links types provider' to 'struct metadata'

This commit is contained in:
Andrew Golovashevich 2026-01-14 04:30:22 +03:00
parent a133d5e187
commit b59b0f03dd
3 changed files with 11 additions and 6 deletions

View File

@ -1,5 +1,7 @@
mod node_ref; mod node_ref;
mod links; mod links;
mod metadata;
pub use node_ref::*; pub use node_ref::*;
pub use links::*; pub use links::*;
pub use metadata::*;

View File

@ -1,11 +1,7 @@
pub trait LinkedStructLinksTypeProvider { pub trait LinkedStructLinksOffset {
type Links: Sized;
}
pub trait LinkedStructLinksOffset: LinkedStructLinksTypeProvider {
type Node; type Node;
type Links;
fn getLinks<R>(nodeRef: &Self::Node, consumer: impl FnOnce(&Self::Links) -> R) -> R; 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; fn getLinksMut<R>(nodeRef: &mut Self::Node, consumer: impl FnOnce(&mut Self::Links) -> R) -> R;
} }

7
src/metadata.rs Normal file
View File

@ -0,0 +1,7 @@
use crate::LinkedStructNodeRef;
pub trait LinkedStructMetadata {
type Links<Node>: Sized;
type NodeRef<Node>: LinkedStructNodeRef;
}