Skip to content

Commit 43eb65d

Browse files
[documentation] Add initial support for links (no parsing yet) [#95]
1 parent 7dce385 commit 43eb65d

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

sources/documentation.rs

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,22 +1507,41 @@ impl Description {
15071507

15081508

15091509
pub struct Links {
1510-
links : StdVec<StdRc<StdBox<str>>>,
1510+
links : EntitiesOwned<Link>,
15111511
}
15121512

15131513

15141514
impl Links {
15151515

15161516
#[ cfg_attr ( feature = "vonuvoli_inline", inline ) ]
1517-
pub fn new (links : StdVec<StdRc<StdBox<str>>>) -> (Links) {
1518-
return Links {
1519-
links : links,
1520-
};
1517+
pub fn links (&self) -> (impl iter::Iterator<Item = &Link>) {
1518+
return self.links.entities ();
15211519
}
15221520

15231521
#[ cfg_attr ( feature = "vonuvoli_inline", inline ) ]
1524-
pub fn links (&self) -> (impl iter::Iterator<Item = &str>) {
1525-
return self.links.iter () .map (StdRc::deref) .map (StdBox::deref);
1522+
pub fn link_resolve (&self, identifier : &str) -> (Option<&Link>) {
1523+
return self.links.entity_resolve (identifier);
1524+
}
1525+
1526+
#[ cfg_attr ( feature = "vonuvoli_inline", inline ) ]
1527+
pub fn has_links (&self) -> (bool) {
1528+
return self.links.has_entities ();
1529+
}
1530+
}
1531+
1532+
1533+
1534+
1535+
pub struct Link {
1536+
identifier : StdRc<StdBox<str>>,
1537+
// FIXME: ...
1538+
}
1539+
1540+
impl Entity for Link {
1541+
1542+
#[ cfg_attr ( feature = "vonuvoli_inline", inline ) ]
1543+
fn identifier_rc_ref (&self) -> (&StdRc<StdBox<str>>) {
1544+
return &self.identifier;
15261545
}
15271546
}
15281547

0 commit comments

Comments
 (0)