Skip to main content

SnapshotIdentifier

Struct SnapshotIdentifier 

Source
pub struct SnapshotIdentifier {
    pub language: String,
    pub project: String,
    pub namespace: u32,
}
Expand description

Snapshot identifier: {language}{project}namespace{number}

§Examples

use wme_models::SnapshotIdentifier;

// Create from components
let id = SnapshotIdentifier::new("en", "wiki", 0);
assert_eq!(id.to_string(), "enwiki_namespace_0");

// Parse from string
let id: SnapshotIdentifier = "enwiki_namespace_0".parse().unwrap();
assert_eq!(id.language, "en");
assert_eq!(id.project, "wiki");
assert_eq!(id.namespace, 0);

// Use predefined constants
let enwiki = SnapshotIdentifier::enwiki_namespace_0();
let dewiki = SnapshotIdentifier::dewiki_namespace_0();

Fields§

§language: String

Language code (e.g., “en”, “de”)

§project: String

Project code (e.g., “wiki”, “wiktionary”)

§namespace: u32

Namespace number

Implementations§

Source§

impl SnapshotIdentifier

Source

pub fn new(language: &str, project: &str, namespace: u32) -> Self

Create a new snapshot identifier.

§Examples
use wme_models::SnapshotIdentifier;

let id = SnapshotIdentifier::new("fr", "wiki", 0);
assert_eq!(id.to_string(), "frwiki_namespace_0");
Source

pub fn enwiki_namespace_0() -> Self

English Wikipedia articles (namespace 0).

Source

pub fn dewiki_namespace_0() -> Self

German Wikipedia articles.

Trait Implementations§

Source§

impl Clone for SnapshotIdentifier

Source§

fn clone(&self) -> SnapshotIdentifier

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SnapshotIdentifier

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for SnapshotIdentifier

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl FromStr for SnapshotIdentifier

Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parse from string (e.g., “enwiki_namespace_0”).

Source§

type Err = ModelError

The associated error which can be returned from parsing.
Source§

impl Hash for SnapshotIdentifier

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for SnapshotIdentifier

Source§

fn eq(&self, other: &SnapshotIdentifier) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for SnapshotIdentifier

Source§

impl StructuralPartialEq for SnapshotIdentifier

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.