[][src]Enum egg_mode::user::UserID

pub enum UserID<'a> {
    ID(u64),
    ScreenName(&'a str),
}

Convenience enum to generalize between referring to an account by numeric ID or by screen name.

Many API calls ask for a user either by either screen name (e.g. rustlang) or by a numeric ID assigned to the account (e.g. 165262228). In egg-mode, these calls are abstracted around this enum, and can take any type that converts into it. This enum has From implementations for the following types:

  • u64
  • &u64 (convenient when used with iterators)
  • &str
  • &&str (convenient when used with iterators)
  • &String (to counteract the fact that deref coercion doesn't work with generics)
  • &UserID (convenient when used with iterators)

This way, when a function in egg-mode has a paremeter of type T: Into<UserID<'a>>, you can call it with any of these types, and it will be converted automatically. egg-mode will then use the proper parameter when performing the call to Twitter.

Variants

ID(u64)

Referring via the account's numeric ID.

ScreenName(&'a str)

Referring via the account's screen name.

Trait Implementations

impl<'a> Clone for UserID<'a>[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<'a> From<u64> for UserID<'a>[src]

impl<'a> From<&'a u64> for UserID<'a>[src]

impl<'a> From<&'a str> for UserID<'a>[src]

impl<'a, 'b> From<&'b &'a str> for UserID<'a>[src]

impl<'a> From<&'a String> for UserID<'a>[src]

impl<'a> From<&'a UserID<'a>> for UserID<'a>[src]

impl<'a> Copy for UserID<'a>[src]

impl<'a> Debug for UserID<'a>[src]

Auto Trait Implementations

impl<'a> Send for UserID<'a>

impl<'a> Sync for UserID<'a>

Blanket Implementations

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T

impl<T> Same<T> for T

type Output = T

Should always be Self