include/Cnx/option/OptionDef.h file

This module provides macro definitions for implementing and working with CnxOption(T)

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Defines

#define CnxOption(T)
Macro alias for CnxOption holding the type T
#define CnxOptionIdentifier(T, Identifier)
Creates an identifier for a function, variable, or struct associated with CnxOption(T)
#define Some(T, value)
Creates a CnxOption(T) holding the given value.
#define None(T)
Creates a CnxOption(T) holding no value.
#define cnx_option_is_some(self)
Returns whether this CnxOption(T) is holding a value.
#define cnx_option_is_none(self)
Returns whether this CnxOption(T) isn't holding a value.
#define cnx_option_as_const(self)
Returns a const reference to the value stored in this CnxOption(T)
#define cnx_option_as_mut(self)
Returns a reference to the value stored in this CnxOption(T)
#define cnx_option_unwrap(self)
Returns the value stored in this CnxOption(T)
#define cnx_option_unwrap_or(self, default_value)
Returns the value stored in this CnxOption(T) , or default_value if this is None(T)
#define cnx_option_unwrap_or_else(self, default_generator)
Returns the value stored in this CnxOption(T) , or the value returned by default_generator if this is None(T)
#define cnx_option_expect(self, panic_message)
Returns the value stored in this CnxOption(T)
#define cnx_option_map(self, MapType, map_func)
Maps the value stored in this CnxOption(T)
#define cnx_option_map_or(self, map_func, default_value)
Maps the value stored in this CnxOption(T)
#define cnx_option_map_or_else(self, map_func, default_generator)
Maps the value stored in this CnxOption(T)
#define cnx_option_and(self, option_b)
Returns option_b if self is Some. Otherwise, returns None
#define cnx_option_and_then(self, next_func)
Returns the result of calling next_func with the contained value if this is Some, otherwise returns None.
#define cnx_option_or(self, option_b)
Returns self if it is Some, otherwise returns option_b
#define cnx_option_or_else(self, func)
Returns self if it is Some, otherwise returns the result of calling func
#define cnx_option_as_bool(self)
Converts the given CnxOption(T) to a bool