[−][src]Struct mediawiki::title::Title
Title struct
Implementations
impl Title
[src]
pub fn new(title: &str, namespace_id: NamespaceID) -> Title
[src]
Constructor, where un-prefixed title and namespace are known. Assumes title has correct capitalization
pub fn new_from_full(full_title: &str, api: &Api) -> Self
[src]
Constructor, where full namespace-prefixed title is known. Uses Api to parse valid namespaces
pub fn new_from_api_result(data: &Value) -> Title
[src]
Constructor, used by Api::result_array_to_titles
pub fn namespace_id(&self) -> NamespaceID
[src]
Returns the namespace ID
pub fn namespace_name<'a>(&self, api: &'a Api) -> Option<&'a str>
[src]
Returns the canonical namespace text, based on the Api
pub fn local_namespace_name<'a>(&self, api: &'a Api) -> Option<&'a str>
[src]
Returns the local namespace text, based on the Api
pub fn with_underscores(&self) -> String
[src]
Returns the non-namespace-prefixed title, with underscores
pub fn pretty(&self) -> &str
[src]
Returns the non-namespace-prefixed title, with spaces instead of underscores
pub fn full_with_underscores(&self, api: &Api) -> Option<String>
[src]
Returns the namespace-prefixed title, with underscores
pub fn full_pretty(&self, api: &Api) -> Option<String>
[src]
Returns the namespace-prefixed title, with spaces instead of underscores
pub fn spaces_to_underscores(s: &str) -> String
[src]
Changes all spaces to underscores
pub fn underscores_to_spaces(s: &str) -> String
[src]
Changes all underscores to spaces
pub fn first_letter_uppercase(s: &str) -> String
[src]
Changes the first letter to uppercase. Enforces spaces instead of underscores.
pub fn toggle_talk(&mut self)
[src]
Changes this Title to refer to the other member of the corresponding article-talk page pair for this page. Won't change Special pages.
Examples
use mediawiki::title::Title; let mut title1 = Title::new("Test", 0); title1.toggle_talk(); assert_eq!(title1, Title::new("Test", 1)); let mut title2 = Title::new("Test", 1); title2.toggle_talk(); assert_eq!(title2, Title::new("Test", 0)); let mut title3 = Title::new("Test", -1); title3.toggle_talk(); assert_eq!(title3, Title::new("Test", -1));
pub fn into_toggle_talk(self) -> Self
[src]
Returns a new Title referring to the other member of the corresponding article-talk page pair for this page. Won't change Special pages.
Examples
use mediawiki::title::Title; assert_eq!(Title::new("Test", 0).into_toggle_talk(), Title::new("Test", 1)); assert_eq!(Title::new("Test", 1).into_toggle_talk(), Title::new("Test", 0)); assert_eq!(Title::new("Test", -1).into_toggle_talk(), Title::new("Test", -1));
Trait Implementations
impl Clone for Title
[src]
impl Debug for Title
[src]
impl Eq for Title
[src]
impl Hash for Title
[src]
pub fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl PartialEq<Title> for Title
[src]
impl StructuralEq for Title
[src]
impl StructuralPartialEq for Title
[src]
Auto Trait Implementations
impl RefUnwindSafe for Title
[src]
impl Send for Title
[src]
impl Sync for Title
[src]
impl Unpin for Title
[src]
impl UnwindSafe for Title
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
pub fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,