pub struct SiteTree { /* private fields */ }Expand description
Code representation of all nodes within the site (hiarchy and how nodes are related)
Implementations§
Source§impl SiteTree
impl SiteTree
Sourcepub fn from_input(input: Input) -> Result<SiteTree, LssgError>
pub fn from_input(input: Input) -> Result<SiteTree, LssgError>
input is a markdown input file from where to start discovering resources and pages
Sourcepub fn is_parent(&self, id: SiteId, parent_id: SiteId) -> bool
pub fn is_parent(&self, id: SiteId, parent_id: SiteId) -> bool
Check if node id has parent_id as (grand)parent node
Sourcepub fn get_input(&self, id: SiteId) -> Option<&Input>
pub fn get_input(&self, id: SiteId) -> Option<&Input>
try and get the input of a node if input exists
pub fn get_by_name(&self, name: &str, id: SiteId) -> Option<&SiteId>
pub fn root(&self) -> SiteId
pub fn get(&self, id: SiteId) -> Result<&SiteNode, LssgError>
Sourcepub fn page_parent(&self, id: SiteId) -> Option<SiteId>
pub fn page_parent(&self, id: SiteId) -> Option<SiteId>
get next parent of page
Sourcepub fn rel_path(&self, from: SiteId, to: SiteId) -> String
pub fn rel_path(&self, from: SiteId, to: SiteId) -> String
Get the relative path between two nodes
pub fn ids(&self) -> Vec<SiteId> ⓘ
pub fn add_link(&mut self, from: SiteId, to: SiteId)
Sourcepub fn links_from(&self, from: SiteId) -> Vec<&Link>
pub fn links_from(&self, from: SiteId) -> Vec<&Link>
Get all the relations from a single node to other nodes
Sourcepub fn add(&mut self, node: SiteNode) -> Result<SiteId, LssgError>
pub fn add(&mut self, node: SiteNode) -> Result<SiteId, LssgError>
Utility function to add a node, create a id and add to parent children
Sourcepub fn add_from_input(
&mut self,
input: Input,
parent_id: SiteId,
) -> Result<SiteId, LssgError>
pub fn add_from_input( &mut self, input: Input, parent_id: SiteId, ) -> Result<SiteId, LssgError>
add from Input, will figure out what node to add from input and will register input not to be used for other nodes
Sourcepub fn add_stylesheet_from_input(
&mut self,
input: Input,
parent: SiteId,
) -> Result<SiteId, LssgError>
pub fn add_stylesheet_from_input( &mut self, input: Input, parent: SiteId, ) -> Result<SiteId, LssgError>
Add a stylesheet and all resources needed by the stylesheet
pub fn remove(&mut self, id: SiteId)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SiteTree
impl !RefUnwindSafe for SiteTree
impl !Send for SiteTree
impl !Sync for SiteTree
impl Unpin for SiteTree
impl !UnwindSafe for SiteTree
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more