cu
Main Page
Data Structures
Files
File List
Globals
option.h
Go to the documentation of this file.
1
#ifndef CU_OPTION_H_
2
#define CU_OPTION_H_
3
4
#include <stdbool.h>
5
18
typedef
struct
option_t
{
19
enum
{
20
none,
21
some,
22
} _options;
23
void
*data;
24
void
*(*unwrap)(
const
struct
option_t
*);
25
void
*(*expect)(
const
struct
option_t
*,
const
char
*msg);
26
void
*(*unwrap_or)(
const
struct
option_t
*,
void
*);
27
bool (*is_some)(
const
struct
option_t
*);
28
bool (*is_none)(
const
struct
option_t
*);
29
}
option_t
;
30
31
32
43
option_t
option
(
void
*data);
44
45
46
60
void
*unwrap(
option_t
*
self
);
61
62
63
78
void
*expect(
option_t
*
self
,
const
char
*msg);
79
80
95
void
*unwrap_or(
option_t
*
self
,
void
*default_val);
96
97
110
bool
is_some(
option_t
*
self
);
111
123
bool
is_none(
option_t
*
self
);
124
#endif // CU_OPTION_H_
option_t
option_t wraps a pointer und does checks whether it is null.
Definition:
option.h:18
option
option_t option(void *data)
Create a new option_t for given pointer.
include
option.h
Generated by
1.8.11