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

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

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.

Implementations

Make a new ListID by supplying its owner and name.

Make a new ListID by supplying its numeric ID.

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

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.