Struct mwtitle::NamespaceMap[][src]

pub struct NamespaceMap { /* fields omitted */ }

Implementations

Creates a NamespaceMap from a SiteInfo.

This is supported on crate feature utils only.

Creates a NamespaceMap by parsing the contents of a JSON or GZipped JSON file like siteinfo-namespaces.json.gz or siteinfo-namespaces.json in the Wikimedia dumps. If the file extension is gz, decompresses from the GZip format before decoding the JSON.

Constructs a NamespaceMap from an iterator yielding NamespaceInfos and an iterator yielding NamespaceAliases.

Errors

If the namespacealiases field contains any ids that are not found in the namespaces field of the SiteInfo, fails and returns Err(Error::UnknownAliases(unrecognized_ids)).

Create a NamespaceMap from two iterators. The first iterator represents namespaces and contains (key, value): (String, String) tuples that represent the fields of a NamespaceInfo. The second contains (alias, id): (String, i32) tuples that each represent a NamespaceAlias.

This is supported on crate feature utils only.

Creates a NamespaceMap by parsing the contents of a Read type that contains the JSON representation of a SiteInfoResponse.

This is supported on crate feature utils only.

Creates a NamespaceMap by parsing the JSON representation of a SiteInfoResponse.

Returns the attributes of the namespace when given a valid namespace ID.

Returns the attributes of the namespace when given a valid namespace ID or name or alias.

Returns the ID of the namespace when given a valid namespace ID or name or alias. In case of an ID, this unnecessarily looks up the ID in the map.

Equivalent of Language::getNsIndex().

Returns the local name of the namespace when given a valid namespace ID or name or alias.

Returns case-sensitivity of the first letter of titles in the namespace when given a valid namespace ID or name or alias.

Returns canonical name for a namespace ID or name or alias, if it is valid and if that namespace has a canonical name.

Whether the first letter of titles in the namespace is always capitalized.

Equivalent of NamespaceInfo::isCapitalized().

Get the title with namespace in pretty aka text form (spaces).

Fragments will not be included.

Returns None if the title’s namespace is not in the map.

Get the title with namespace in underscore aka dbkey form. This is potentially useful when you want to make a database query.

Fragments will not be included.

Returns None if the title’s namespace is not in the map

Get the title with namespace in pretty aka text form (spaces), with the fragment, if one exists, appended.

Returns None if the title’s namespace is not in the map.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.