Struct mwtitle::NamespaceInfo
source · [−]pub struct NamespaceInfo {
pub id: i32,
pub case: String,
pub name: String,
pub canonical: Option<String>,
}
Expand description
Represents a namespace object in the namespaces
field of a SiteInfo
.
Contains only the fields required to generate a NamespaceMap
that can be used
by a TitleCodec
to parse the namespace in a Title
.
Supports formatversion=1
with the local namespace name in the "*"
field,
and formatversion=2
with the local namespace name in the "name"
field.
Fields
id: i32
case: String
name: String
canonical: Option<String>
Implementations
sourceimpl NamespaceInfo
impl NamespaceInfo
sourcepub fn try_from_iter<I: IntoIterator<Item = (String, String)>>(
iter: I
) -> Result<Self>
pub fn try_from_iter<I: IntoIterator<Item = (String, String)>>(
iter: I
) -> Result<Self>
Fallibly convert a HashMap<String, String>
and a String
into a NamespaceInfo
.
Errors
Fails if any of the keys "id"
, "case"
is missing,
or if the value for "id"
cannot be parsed as an i32
.
Trait Implementations
sourceimpl Clone for NamespaceInfo
impl Clone for NamespaceInfo
sourcefn clone(&self) -> NamespaceInfo
fn clone(&self) -> NamespaceInfo
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for NamespaceInfo
impl Debug for NamespaceInfo
sourceimpl<'de> Deserialize<'de> for NamespaceInfo
impl<'de> Deserialize<'de> for NamespaceInfo
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Ord for NamespaceInfo
impl Ord for NamespaceInfo
sourceimpl PartialEq<NamespaceInfo> for NamespaceInfo
impl PartialEq<NamespaceInfo> for NamespaceInfo
sourcefn eq(&self, other: &NamespaceInfo) -> bool
fn eq(&self, other: &NamespaceInfo) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &NamespaceInfo) -> bool
fn ne(&self, other: &NamespaceInfo) -> bool
This method tests for !=
.
sourceimpl PartialOrd<NamespaceInfo> for NamespaceInfo
impl PartialOrd<NamespaceInfo> for NamespaceInfo
sourcefn partial_cmp(&self, other: &NamespaceInfo) -> Option<Ordering>
fn partial_cmp(&self, other: &NamespaceInfo) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Eq for NamespaceInfo
impl StructuralEq for NamespaceInfo
impl StructuralPartialEq for NamespaceInfo
Auto Trait Implementations
impl RefUnwindSafe for NamespaceInfo
impl Send for NamespaceInfo
impl Sync for NamespaceInfo
impl Unpin for NamespaceInfo
impl UnwindSafe for NamespaceInfo
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more