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

pub enum ListID<'a> {
    Slug(UserID<'a>, &'a 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

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

Referring via the list's numeric ID.

Methods

impl<'a> ListID<'a>
[src]

[src]

Make a new ListID by supplying its owner and name.

[src]

Make a new ListID by supplying its numeric ID.

Trait Implementations

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

[src]

Formats the value using the given formatter.

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

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

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more