Skip to content

Commit

Permalink
Add ShardId::get (#2828)
Browse files Browse the repository at this point in the history
  • Loading branch information
GnomedDev authored Apr 1, 2024
1 parent d5a71ed commit d14af53
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/model/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,17 @@ id_u64! {
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)]
pub struct ShardId(pub u32);

impl ShardId {
/// Retrieves the value as a [`u32`].
///
/// This is not a [`u64`] as [`ShardId`]s are not a discord concept and are simply used for
/// internal type safety.
#[must_use]
pub fn get(self) -> u32 {
self.0
}
}

impl fmt::Display for ShardId {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.0)
Expand Down

0 comments on commit d14af53

Please sign in to comment.