Function mediawiki::title::toggle_namespace_id

source ·
pub fn toggle_namespace_id(id: NamespaceID) -> Option<NamespaceID>
Expand description

If the provided ID refers to a…

  • content namespace, return the ID of the corresponding talk namespace.
  • talk namespace, return the ID of the corresponding content namespace.
  • special namespace, return None.

§Examples

use mediawiki::title::toggle_namespace_id;
assert_eq!(toggle_namespace_id(0), Some(1));
assert_eq!(toggle_namespace_id(1), Some(0));
assert_eq!(toggle_namespace_id(-1), None);