Wayland.MsgBuilding and parsing messages.
An ('a, 'rw) t is a message for the 'a interface. 'rw is `R for an incoming message to be read, or `W for an outgoing message to be written.
val pp_args : Metadata.arg list -> (_, _) t Fmt.tpp_args types is a formatter for messages with argument types types.
val parse :
fds:Unix.file_descr Stdlib.Queue.t ->
Cstruct.t ->
('a, [ `R ]) t optionparse ~fds buf returns the first message in buf, if any. When get_fd is called, it will take one from fds. Returns None if buf does not contain a complete message.
val obj : (_, _) t -> int32obj t is the object ID in the message header.
val op : (_, _) t -> intop t is the operation ID in the message header.
val length : (_, _) t -> intlength t is the total size of the message (including any space for arguments not yet added).
val get_int : (_, _) t -> int32get_int t returns the next argument (which must be an integer) from t and advances the next-argument pointer.
val get_string : (_, _) t -> stringget_string t returns the next argument (which must be a string) from t and advances the next-argument pointer. The string returned does not include the trailing '\0'.
val get_string_opt : (_, _) t -> string optionget_string_opt t returns the next argument (which must be a string or NULL) from t and advances the next-argument pointer. The string returned does not include the trailing '\0'.
val get_array : (_, _) t -> stringget_array t returns the next argument (which must be array) from t and advances the next-argument pointer.
val get_fd : (_, _) t -> Unix.file_descrget_fd t takes the next FD from the queue. It raises an exception if the queue is empty. Note that the Wayland protocol does not indicate which FDs below to which messages, so if used incorrectly this will remove FDs intended for other messages. The caller takes ownership of the FD and is responsible for closing it.
get_fixed t returns the next argument (which must be a fixed-point number) from t and advances the next-argument pointer.
val alloc :
obj:int32 ->
op:int ->
ints:int ->
strings:string option list ->
arrays:string list ->
('a, [ `W ]) tSee Proxy.alloc.
val add_int : (_, [ `W ]) t -> int32 -> unitval add_string : (_, [ `W ]) t -> string -> unitval add_string_opt : (_, [ `W ]) t -> string option -> unitval add_array : (_, [ `W ]) t -> string -> unitval add_fd : (_, [ `W ]) t -> Unix.file_descr -> unitadd_fd t fd adds a copy of fd (made with Unix.dup) to the message.