aboutsummaryrefslogtreecommitdiff
path: root/lib/opcode.mli
diff options
context:
space:
mode:
authorAdelyn Breelove <[email protected]>2019-01-21 12:14:58 -0700
committerAdelyn Breelove <[email protected]>2019-01-21 12:14:58 -0700
commitef93c7448f6c74ec20bd7846cb324b836bb2e222 (patch)
tree5ed470e09b45279a07202ea22d62dc9ef2935724 /lib/opcode.mli
parentFinalize signatures (diff)
downloaddisml-ef93c7448f6c74ec20bd7846cb324b836bb2e222.tar.xz
disml-ef93c7448f6c74ec20bd7846cb324b836bb2e222.zip
More signature improvements
Diffstat (limited to 'lib/opcode.mli')
-rw-r--r--lib/opcode.mli33
1 files changed, 22 insertions, 11 deletions
diff --git a/lib/opcode.mli b/lib/opcode.mli
index e07f82e..b0e7adb 100644
--- a/lib/opcode.mli
+++ b/lib/opcode.mli
@@ -1,18 +1,29 @@
+(** Internal Opcode abstractions. *)
+
+(** Type of known opcodes. *)
type t =
- | DISPATCH
- | HEARTBEAT
- | IDENTIFY
- | STATUS_UPDATE
- | VOICE_STATE_UPDATE
- | RESUME
- | RECONNECT
- | REQUEST_GUILD_MEMBERS
- | INVALID_SESSION
- | HELLO
- | HEARTBEAT_ACK
+| DISPATCH
+| HEARTBEAT
+| IDENTIFY
+| STATUS_UPDATE
+| VOICE_STATE_UPDATE
+| RESUME
+| RECONNECT
+| REQUEST_GUILD_MEMBERS
+| INVALID_SESSION
+| HELLO
+| HEARTBEAT_ACK
+(** Raised when receiving an invalid opcode. This should never occur. *)
exception Invalid_Opcode of int
+(** Converts an opcode to its integer form for outgoing frames. *)
val to_int : t -> int
+
+(** Converts an integer to an opcode for incoming frames.
+ Raise {!Invalid_Opcode} Raised when an unkown opcode is received.
+*)
val from_int : int -> t
+
+(** Converts and opcode to a human-readable string. Used for logging purposes. *)
val to_string : t -> string \ No newline at end of file