Skip to content

Commit

Permalink
[documentation] Add initial support for links (no parsing yet) [#95]
Browse files Browse the repository at this point in the history
  • Loading branch information
cipriancraciun committed Jun 29, 2018
1 parent 7dce385 commit 43eb65d
Showing 1 changed file with 26 additions and 7 deletions.
33 changes: 26 additions & 7 deletions sources/documentation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1507,22 +1507,41 @@ impl Description {


pub struct Links {
links : StdVec<StdRc<StdBox<str>>>,
links : EntitiesOwned<Link>,
}


impl Links {

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

#[ cfg_attr ( feature = "vonuvoli_inline", inline ) ]
pub fn links (&self) -> (impl iter::Iterator<Item = &str>) {
return self.links.iter () .map (StdRc::deref) .map (StdBox::deref);
pub fn link_resolve (&self, identifier : &str) -> (Option<&Link>) {
return self.links.entity_resolve (identifier);
}

#[ cfg_attr ( feature = "vonuvoli_inline", inline ) ]
pub fn has_links (&self) -> (bool) {
return self.links.has_entities ();
}
}




pub struct Link {
identifier : StdRc<StdBox<str>>,
// FIXME: ...
}

impl Entity for Link {

#[ cfg_attr ( feature = "vonuvoli_inline", inline ) ]
fn identifier_rc_ref (&self) -> (&StdRc<StdBox<str>>) {
return &self.identifier;
}
}

Expand Down

0 comments on commit 43eb65d

Please sign in to comment.