pure-option/pureoption-example.c

16 lines
394 B
C

#include "pureoption.h"
#include <stdio.h>
int main(void) {
pureoption opt = pureoption_some(3);
printf("pureoption_some(3)\n");
printf("\thas value: %s\n", pureoption_has(opt) == 1 ? "yes" : "no");
printf("\tvalue: %d\n", pureoption_get(int, opt));
opt = pureoption_none();
printf("pureoption_none\n");
printf("\thas value: %s\n", pureoption_has(opt) == 1 ? "yes" : "no");
}