[][src]Enum egg_mode::list::ListID

pub enum ListID {
    Slug(UserIDCow<'static, str>),
    ID(u64),
}

Convenience enum to refer to a list via its owner and name or via numeric ID.

Any API call that needs to reference a specific list has a set of parameters that collectively refer to it. Not only do lists have a unique numeric ID that refers to them, they have a "slug" that stands in as the list's unique name. This slug is only unique when taken in combination with the user that created it, though, so this leads to the raw API call having parameters that refer to the user by screen name or ID, or the list as a whole by this pair of slug parameters or the single ID parameter. egg-mode wraps this pattern with this ListID enum.

Because the slug is formed from two variables instead of one, this enum foregoes the many From implementations that UserID has and instead opts for two creation functions. If you have a user/name combo, use ListID::from_slug when looking for the list. If you have the list's ID instead, then you can use ListID::from_id.

Example

use egg_mode::list::ListID;

//The following two ListIDs refer to the same list:
let slug = ListID::from_slug("Twitter", "support");
let id = ListID::from_id(99924643);

Variants

Slug(UserIDCow<'static, str>)

Referring via the list's owner and its "slug" or name.

ID(u64)

Referring via the list's numeric ID.

Methods

impl ListID[src]

pub fn from_slug<T: Into<UserID>>(
    owner: T,
    list_name: impl Into<Cow<'static, str>>
) -> ListID
[src]

Make a new ListID by supplying its owner and name.

pub fn from_id(list_id: u64) -> ListID[src]

Make a new ListID by supplying its numeric ID.

Trait Implementations

impl Clone for ListID[src]

impl Debug for ListID[src]

Auto Trait Implementations

impl RefUnwindSafe for ListID

impl Send for ListID

impl Sync for ListID

impl Unpin for ListID

impl UnwindSafe for ListID

Blanket Implementations

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

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

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

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self

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

type Owned = T

The resulting type after obtaining ownership.

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<V, T> VZip<V> for T where
    V: MultiLane<T>,