crux_structs v0.2.3 Crux.Structs.Presence.ActivityFlags View Source
Custom non discord API struct helping with the usage of presence activity flags.
Link to this section Summary
Types
Union type of all valid presence activity flags.
Raw bitfield that can be used as a t:resolvable/0
.
All valid types that can be directly resolved into a bitfield.
Functions
Add all set bits of to_add
to base
.
Get an integer representing all available bits set.
Check whether the t:resolvable/0
you have
has everything set you want
.
Return a t:t/0
of all bits you want
but not have
.
Create a new t:t/0
from a t:resolvable/0
.
Remove all set bits of to_remove
from base
.
Resolve a t:resolvable/0
into a bitfield.
Serialize a t:resolvable/0
into a list of set bit flag names.
Serialize a t:resolvable/0
into a map representing bit flag names to whether they are set.
Link to this section Types
Specs
name() :: :instance | :join | :spectate | :join_request | :sync | :play
Union type of all valid presence activity flags.
Specs
raw() :: non_neg_integer()
Raw bitfield that can be used as a t:resolvable/0
.
Specs
resolvable() :: t() | raw() | name() | [resolvable()]
All valid types that can be directly resolved into a bitfield.
Specs
t() :: %Crux.Structs.Presence.ActivityFlags{bitfield: non_neg_integer()}
Link to this section Functions
Specs
add(base :: resolvable(), to_add :: resolvable()) :: t()
Add all set bits of to_add
to base
.
Specs
all() :: non_neg_integer()
Get an integer representing all available bits set.
Specs
flags() :: %{required(name()) => non_neg_integer()}
Get a map of t:name/0
s and their corresponding bit values.
Specs
has(have :: resolvable(), want :: resolvable()) :: boolean()
Check whether the t:resolvable/0
you have
has everything set you want
.
Specs
missing(resolvable(), resolvable()) :: t()
Return a t:t/0
of all bits you want
but not have
.
Specs
names() :: [name()]
Get a list of all available t:name/0
s.
Specs
new(resolvable()) :: t()
Create a new t:t/0
from a t:resolvable/0
.
Specs
remove(base :: resolvable(), to_remove :: resolvable()) :: t()
Remove all set bits of to_remove
from base
.
Specs
resolve(resolvable()) :: non_neg_integer()
Resolve a t:resolvable/0
into a bitfield.
Specs
to_list(resolvable()) :: [name()]
Serialize a t:resolvable/0
into a list of set bit flag names.
Specs
to_map(resolvable()) :: %{required(name()) => boolean()}
Serialize a t:resolvable/0
into a map representing bit flag names to whether they are set.