pub struct LinkBase { /* private fields */ }Expand description
Where a page’s relative link targets resolve, as a browser resolves the links of the page at its address: a,
./a and ../a from its folder, ?q and #f on the page itself, //host/a with its scheme, and /a from its
host, or from a root set with LinkBase::rooted_at.
Implementations§
Source§impl LinkBase
impl LinkBase
Sourcepub fn new(page_url: &str) -> Result<Self, LinkBaseError>
pub fn new(page_url: &str) -> Result<Self, LinkBaseError>
The base of the page at page_url, an absolute http or https URL of printable ASCII; its fragment is dropped.
Sourcepub fn rooted_at(
self,
prefix: &str,
root_url: &str,
) -> Result<Self, LinkBaseError>
pub fn rooted_at( self, prefix: &str, root_url: &str, ) -> Result<Self, LinkBaseError>
The base with the root-relative targets whose path starts with prefix resolving under root_url instead of
the page’s host: with /uploads/ and https://gitlab.com/group/project, /uploads/a.pdf becomes
https://gitlab.com/group/project/uploads/a.pdf; / roots every such target. Their .. never climbs above
the root, whose query and fragment are ignored. A later call replaces the root.