Archived
3
0

Crystal bindings: removing a useless CBOR function.

This commit is contained in:
Philippe Pittoli 2023-02-03 05:36:04 +01:00
parent 1c850be4cf
commit 6a912202e4

View File

@ -1,4 +1,5 @@
require "cbor"
require "./main.cr"
# IPC::CBOR is the root class for all exchanged messages (using CBOR).
# IPC::CBOR inherited classes have a common 'type' class attribute,
@ -42,19 +43,6 @@ class IPC
end
end
# CAUTION: Only use this method on an Array(IPC::CBOR.class)
class Array(T)
def parse_ipc_cbor(message : IPC::Message) : IPC::CBOR?
message_type = find &.type.==(message.utype)
if message_type.nil?
raise "invalid message type (#{message.utype})"
end
message_type.from_cbor message.payload
end
end
# CAUTION: only use this method on an Array(IPC::CBOR.class).
class Array(T)
def parse_ipc_cbor(message : IPCMessage::TypedMessage) : IPC::CBOR?