Skip to content

Commit d14af53

Browse files
authored
Add ShardId::get (#2828)
1 parent d5a71ed commit d14af53

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/model/id.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,17 @@ id_u64! {
288288
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)]
289289
pub struct ShardId(pub u32);
290290

291+
impl ShardId {
292+
/// Retrieves the value as a [`u32`].
293+
///
294+
/// This is not a [`u64`] as [`ShardId`]s are not a discord concept and are simply used for
295+
/// internal type safety.
296+
#[must_use]
297+
pub fn get(self) -> u32 {
298+
self.0
299+
}
300+
}
301+
291302
impl fmt::Display for ShardId {
292303
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
293304
write!(f, "{}", self.0)

0 commit comments

Comments
 (0)