Struct mwtitle::Title [−][src]
pub struct Title { /* fields omitted */ }
Expand description
Represents a MediaWiki title. A title can be broken down into the following
attributes: [[interwiki:ns:db_key#fragment]]
.
interwiki
: Optional prefix pointing to another sitenamespace
: Numerical ID corresponding to a MediaWiki namespacedbkey
: Page name, with underscores instead of spacesfragment
: Optional anchor for a specific section
// ns1 is Talk, so this is [[Talk:Main Page]]
let title = Title::new_unchecked(1, "Main_Page");
assert_eq!(title.namespace(), 1);
assert_eq!(title.dbkey(), "Main_Page");
assert!(title.interwiki().is_none());
assert!(title.fragment().is_none());
let title = title.with_fragment("Section 1");
assert_eq!(title.fragment(), Some("Section 1"));
Implementations
Create a new Title
, with no validation on the namespace
or text parts. Good if you’re getting the title from a
trusted place like the API. If the namespace does not exist
in the TitleCodec
this is used with it can result in panics.
Note that text is supposed to be the database key, with no namespace prefix.
Set a fragment.
Remove the fragment.
Whether this title was created via a local interwiki link.
If the title is a local page that could exist, basically not an interwiki link, nor a fragment-only link, nor a special page.
Whether this title refers to a category.
Trait Implementations
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl RefUnwindSafe for Title
impl UnwindSafe for Title
Blanket Implementations
Mutably borrows from an owned value. Read more