ds 0.10.0
A C library to safely yet efficiently work with UTF-8–encoded, growable dynamic strings.
result.c File Reference

Implementation of the Result enumeration type, related constants and functions. More...

#include <stdbool.h>
#include "ds/result.h"
Include dependency graph for result.c:

Go to the source code of this file.

Functions

bool ds_result_is_ok (ds_result_t const self)
 Returns true if self is Ok. More...
 
bool ds_result_is_err (ds_result_t const self)
 Returns true if self is a DS_RESULT_ERR_* variant. More...
 

Detailed Description

Implementation of the Result enumeration type, related constants and functions.

Author
Avinash Maddikonda (svass.nosp@m.saka.nosp@m.vi@gm.nosp@m.ail..nosp@m.com)
Since
0.6.0
Date
2023-08-01

Definition in file result.c.

Function Documentation

◆ ds_result_is_err()

bool ds_result_is_err ( ds_result_t  self)

Returns true if self is a DS_RESULT_ERR_* variant.

Parameters
selfThe value to check.
Returns
true if self is a DS_RESULT_ERR_* variant. false otherwise.

Examples

Basic usage:

assert (!ds_result_is_err (x));
assert (ds_result_is_err (y));
ds_result_t
Result is a type that represents either success (Ok) or failure (a DS_RESULT_ERR_* variant).
Definition: result.h:26
@ DS_RESULT_ERR_PTR_IS_NULL
Represents failure due to an unexpected NULL pointer.
Definition: result.h:31
@ DS_RESULT_OK
Represents success.
Definition: result.h:28
bool ds_result_is_err(ds_result_t self)
Returns true if self is a DS_RESULT_ERR_* variant.
Definition: result.c:19

Definition at line 19 of file result.c.

Here is the call graph for this function:

◆ ds_result_is_ok()

bool ds_result_is_ok ( ds_result_t  self)

Returns true if self is Ok.

Parameters
selfThe value to check.
Returns
true if self is Ok, and false otherwise.

Examples

Basic usage:

assert (ds_result_is_ok (x));
assert (!ds_result_is_ok (y));
bool ds_result_is_ok(ds_result_t self)
Returns true if self is Ok.
Definition: result.c:13

Definition at line 13 of file result.c.

Here is the caller graph for this function: