您将如何在 Zig 中等效地声明以下结构?
static struct lws_protocols protocols[] = {
{ "http", lws_callback_http_dummy, 0, 0 },
LWS_PLUGIN_PROTOCOL_MINIMAL,
{ NULL, NULL, 0, 0 } /* terminator */
};
查看LWS_PLUGIN_PROTOCOL_MINIMAL
,它在标题中定义为:
#define LWS_PLUGIN_PROTOCOL_MINIMAL \
{ \
"lws-minimal-proxy", \
callback_minimal, \
sizeof(struct per_session_data__minimal), \
128, \
0, NULL, 0 \
}
和
struct lws_protocols {
const char *name;
lws_callback_function *callback;
size_t per_session_data_size;
size_t rx_buffer_size;
unsigned int id;
void *user;
size_t tx_packet_size;
};