I'm trying to write a Crystal wrapper around libevent
, and I wondered how to approach its enums that are named as all lower-case, for instance:
enum ev_http_request_error:
I tried the following:
@[Link("event")]
lib LibEvent
# <snip>
enum evhttp_request_error
EVREQ_HTTP_TIMEOUT,
EVREQ_HTTP_EOF,
EVREQ_HTTP_INVALID_HEADER,
EVREQ_HTTP_BUFFER_ERROR,
EVREQ_HTTP_DATA_TOO_LONG
end
end
but this fails because evhttp_request_error
doesn't fit the grammar for a Crystal constant.
How should I address this?