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

pub enum UserID {
    ID(u64),
    ScreenName(Cow<'static, str>),
}
Expand description

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>, 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(Cow<'static, str>)

Referring via the account’s screen name.

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

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

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.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Should always be Self

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)

recently added

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.