twilight_model/id/marker.rs
1//! Markers for various resource types, such as channels or users.
2//!
3//! Markers themselves perform no logical action, and are only used to
4//! ensure that IDs of incorrect types aren't used. If IDs were only 64-bit
5//! integers then a role's ID may be erroneously used in the place of where
6//! a user's ID is required; by using markers it can be ensured that only an
7//! ID with a [`RoleMarker`] can be used where a role's ID is required.
8
9// DEVELOPMENT: When adding a new marker, be sure to add its implementation to
10// `util/snowflake`.
11
12/// Marker for application IDs.
13///
14/// Types such as [`Message::application_id`] or [`Guild::application_id`]
15/// use this ID marker.
16///
17/// [`Guild::application_id`]: crate::guild::Guild::application_id
18/// [`Message::application_id`]: crate::channel::Message::application_id
19#[derive(Debug)]
20#[non_exhaustive]
21pub struct ApplicationMarker;
22
23/// Marker for attachment IDs.
24///
25/// Types such as [`Attachment`] use this ID marker.
26///
27/// [`Attachment`]: crate::channel::Attachment
28#[derive(Debug)]
29#[non_exhaustive]
30pub struct AttachmentMarker;
31
32/// Marker for audit log entry IDs.
33///
34/// Types such as [`AuditLogEntry`] use this ID marker.
35///
36/// [`AuditLogEntry`]: crate::guild::audit_log::AuditLogEntry
37#[derive(Debug)]
38#[non_exhaustive]
39pub struct AuditLogEntryMarker;
40
41/// Marker for auto moderation rule IDs.
42///
43/// Types such as [`AutoModerationRule`] use this ID marker.
44///
45/// [`AutoModerationRule`]: crate::guild::auto_moderation::AutoModerationRule
46#[derive(Debug)]
47#[non_exhaustive]
48pub struct AutoModerationRuleMarker;
49
50/// Marker for channel IDs.
51///
52/// Types such as [`Channel`] or [`GatewayReaction`] use this ID marker.
53///
54/// [`Channel`]: crate::channel::Channel
55/// [`GatewayReaction`]: crate::gateway::GatewayReaction
56#[derive(Debug)]
57#[non_exhaustive]
58pub struct ChannelMarker;
59
60/// Marker for command IDs.
61///
62/// Types such as [`Command`] use this ID marker.
63///
64/// [`Command`]: crate::application::command::Command
65#[derive(Debug)]
66#[non_exhaustive]
67pub struct CommandMarker;
68
69/// Marker for command versions.
70///
71/// Types such as [`Command`] use this ID marker.
72///
73/// [`Command`]: crate::application::command::Command
74#[derive(Debug)]
75#[non_exhaustive]
76pub struct CommandVersionMarker;
77
78/// Marker for emoji IDs.
79///
80/// Types such as [`Emoji`] or [`ReactionType`] use this ID marker.
81///
82/// [`Emoji`]: crate::guild::Emoji
83/// [`ReactionType`]: crate::channel::message::ReactionType
84#[derive(Debug)]
85#[non_exhaustive]
86pub struct EmojiMarker;
87
88/// Marker for entitlement IDs.
89///
90/// Types such as [`Entitlement`] use this ID marker.
91///
92/// [`Entitlement`]: crate::application::monetization::entitlement::Entitlement
93#[derive(Debug)]
94#[non_exhaustive]
95pub struct EntitlementMarker;
96
97/// Marker for entitlement SKU IDs.
98///
99/// Types such as [`Sku`] use this ID marker.
100///
101/// [`Sku`]: crate::application::monetization::sku::Sku
102#[derive(Debug)]
103#[non_exhaustive]
104pub struct SkuMarker;
105
106/// Marker for generic IDs.
107///
108/// Types such as [`AuditLogChange::Id`] or [`CommandOptionValue`] use this
109/// ID marker.
110///
111/// [`AuditLogChange::Id`]: crate::guild::audit_log::AuditLogChange::Id
112/// [`CommandOptionValue`]: crate::application::interaction::application_command::CommandOptionValue
113#[derive(Debug)]
114#[non_exhaustive]
115pub struct GenericMarker;
116
117/// Marker for guild IDs.
118///
119/// Types such as [`Guild`] or [`Message`] use this ID marker.
120///
121/// [`Guild`]: crate::guild::Guild
122/// [`Message`]: crate::channel::Message
123#[derive(Debug)]
124#[non_exhaustive]
125pub struct GuildMarker;
126
127/// Marker for integration IDs.
128///
129/// Types such as [`GuildIntegration`] or [`RoleTags`] use this ID marker.
130///
131/// [`GuildIntegration`]: crate::guild::GuildIntegration
132/// [`RoleTags`]: crate::guild::RoleTags
133#[derive(Debug)]
134#[non_exhaustive]
135pub struct IntegrationMarker;
136
137/// Marker for interaction IDs.
138///
139/// Types such as [`Interaction`] or [`MessageInteraction`] use this ID
140/// marker.
141///
142/// [`Interaction`]: crate::application::interaction::Interaction
143/// [`MessageInteraction`]: crate::channel::message::MessageInteraction
144#[derive(Debug)]
145#[non_exhaustive]
146pub struct InteractionMarker;
147
148/// Marker for message IDs.
149///
150/// Types such as [`Message`] or [`GatewayReaction`] use this ID marker.
151///
152/// [`Message`]: crate::channel::Message
153/// [`GatewayReaction`]: crate::gateway::GatewayReaction
154#[derive(Debug)]
155#[non_exhaustive]
156pub struct MessageMarker;
157
158/// Marker for OAuth SKU IDs.
159///
160/// Types such as [`Application`] use this ID marker.
161///
162/// [`Application`]: crate::oauth::Application
163#[derive(Debug)]
164#[non_exhaustive]
165pub struct OauthSkuMarker;
166
167/// Marker for OAuth team IDs.
168///
169/// Types such as [`Team`] or [`TeamMember`] use this ID marker.
170///
171/// [`Team`]: crate::oauth::team::Team
172/// [`TeamMember`]: crate::oauth::team::TeamMember
173#[derive(Debug)]
174#[non_exhaustive]
175pub struct OauthTeamMarker;
176
177/// Marker for onboarding prompt IDs.
178///
179/// Types such as [`OnboardingPrompt`] use this ID marker.
180///
181/// [`OnboardingPrompt`]: crate::guild::onboarding::OnboardingPrompt
182#[derive(Debug)]
183#[non_exhaustive]
184pub struct OnboardingPromptMarker;
185
186/// Marker for onboarding prompt option IDs.
187///
188/// Types such as [`OnboardingPromptOption`] use this ID marker.
189///
190/// [`OnboardingPromptOption`]: crate::guild::onboarding::OnboardingPromptOption
191#[derive(Debug)]
192#[non_exhaustive]
193pub struct OnboardingPromptOptionMarker;
194
195/// Marker for role IDs.
196///
197/// Types such as [`Member`] or [`Role`] use this ID marker.
198///
199/// [`Member`]: crate::guild::Member
200/// [`Role`]: crate::guild::Role
201#[derive(Debug)]
202#[non_exhaustive]
203pub struct RoleMarker;
204
205/// Marker for scheduled event IDs.
206///
207/// Types such as [`GuildScheduledEvent`] use this ID marker.
208///
209/// [`GuildScheduledEvent`]: crate::guild::scheduled_event::GuildScheduledEvent
210#[derive(Debug)]
211#[non_exhaustive]
212pub struct ScheduledEventMarker;
213
214/// Marker for scheduled event entity IDs.
215///
216/// Types such as [`GuildScheduledEvent`] use this ID marker.
217///
218/// [`GuildScheduledEvent`]: crate::guild::scheduled_event::GuildScheduledEvent
219#[derive(Debug)]
220#[non_exhaustive]
221pub struct ScheduledEventEntityMarker;
222
223/// Marker for stage IDs.
224///
225/// Types such as [`StageInstance`] use this ID marker.
226///
227/// [`StageInstance`]: crate::channel::StageInstance
228#[derive(Debug)]
229#[non_exhaustive]
230pub struct StageMarker;
231
232/// Marker for sticker banner asset IDs.
233///
234/// Types such as [`StickerPack`] use this ID marker.
235///
236/// [`StickerPack`]: crate::channel::message::sticker::StickerPack
237#[derive(Debug)]
238#[non_exhaustive]
239pub struct StickerBannerAssetMarker;
240
241/// Marker for sticker IDs.
242///
243/// Types such as [`Message`] or [`Sticker`] use this ID marker.
244///
245/// [`Message`]: crate::channel::Message
246/// [`Sticker`]: crate::channel::message::sticker::Sticker
247#[derive(Debug)]
248#[non_exhaustive]
249pub struct StickerMarker;
250
251/// Marker for sticker pack IDs.
252///
253/// Types such as [`Sticker`] or [`StickerPack`] use this ID marker.
254///
255/// [`Sticker`]: crate::channel::message::sticker::Sticker
256/// [`StickerPack`]: crate::channel::message::sticker::StickerPack
257#[derive(Debug)]
258#[non_exhaustive]
259pub struct StickerPackMarker;
260
261/// Marker for sticker pack SKU IDs.
262///
263/// Types such as [`StickerPack`] use this ID marker.
264///
265/// [`StickerPack`]: crate::channel::message::sticker::StickerPack
266#[derive(Debug)]
267#[non_exhaustive]
268pub struct StickerPackSkuMarker;
269
270/// Marker for SKU IDs.
271///
272/// Types such as [`RoleTags`] use this ID marker.
273///
274/// [`RoleTags`]: crate::guild::RoleTags
275#[derive(Debug)]
276#[non_exhaustive]
277pub struct RoleSubscriptionSkuMarker;
278
279/// Marker for forum tag IDs.
280///
281/// Types such as [`ForumTag`] use this ID marker.
282///
283/// [`ForumTag`]: crate::channel::forum::ForumTag
284#[derive(Debug)]
285#[non_exhaustive]
286pub struct TagMarker;
287
288/// Marker for user IDs.
289///
290/// Types such as [`Channel`] or [`User`] use this ID marker.
291///
292/// [`Channel`]: crate::channel::Channel
293/// [`User`]: crate::user::User
294#[derive(Debug)]
295#[non_exhaustive]
296pub struct UserMarker;
297
298/// Marker for webhook IDs.
299///
300/// Types such as [`Webhook`] use this ID marker.
301///
302/// [`Webhook`]: crate::channel::webhook::Webhook
303#[derive(Debug)]
304#[non_exhaustive]
305pub struct WebhookMarker;
306
307/// SKU ID marker for avatar decoration data.
308///
309/// Types such as [`AvatarDecorationData`] use this ID marker.
310///
311/// [`AvatarDecorationData`]: crate::user::AvatarDecorationData
312#[derive(Debug)]
313#[non_exhaustive]
314pub struct AvatarDecorationDataSkuMarker;