module
Monadic InterfacesCnx provides some uniform interfaces for some of its monad-like types
Defines
- #define if_let(var, self)
if_
provides an abstraction to conditionally retrieve a valuelet(var, self)
Define documentation
#define if_let(var,
self)
#include <include/Cnx/monadic/IfLet.h>
if_
provides an abstraction to conditionally retrieve a value
Parameters | |
---|---|
var | - The name for the variable the value held by self will be extracted to |
self | - The CnxOption(T) , CnxResult(T) , or other compatible type potentially holding a value |
if_
provides an abstraction to conditionally retrieve a value from a conditional wrapper type, like CnxOption(T)
or CnxResult(T)
, and then perform some operations with that value. Example:
CnxOption(u32) do_thing(void); void example(void) { let_mut maybe_thing = do_thing(); if_let(thing, maybe_thing) { // do something with thing... } else { // handle maybe_thing being `None(T)` } }