mirror of
https://github.com/RGBCube/bonfire.v
synced 2025-07-28 22:47:45 +00:00
Add snowflake_holder.v
This commit is contained in:
parent
bb2031ff05
commit
e7ae4727da
1 changed files with 13 additions and 0 deletions
13
src/snowflake_holder.v
Normal file
13
src/snowflake_holder.v
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
module bonfire
|
||||||
|
|
||||||
|
// SnowflakeHolder is a small util class that holds a single snowflake.
|
||||||
|
// Useful because all Discord objects have a field named ID.
|
||||||
|
[noinit]
|
||||||
|
pub struct SnowflakeHolder {
|
||||||
|
id Snowflake
|
||||||
|
}
|
||||||
|
|
||||||
|
// created_at returns the time the snowflake was created.
|
||||||
|
fn (sh SnowflakeHolder) created_at() Time {
|
||||||
|
return sh.id.created_at()
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue