include/Cnx/result/ResultDef.h file

This module provides macro definitions for implementing and working with CnxResult(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 CnxResult(T)
Macro Alias used to refer to an instantiation of CnxResult(T) for type T
#define CnxResultIdentifier(T, Identifier)
Macro to create and refer to an identifier (function, variable, struct) related to an instantiation of CnxResult(T) of type T
#define Ok(T, value)
Creates a CnxResult(T) holding the given value.
#define Err(T, error)
Creates a CnxResult(T) holding the given error.
#define cnx_result_is_ok(self)
Returns whether this CnxResult(T) is holding a value.
#define cnx_result_is_err(self)
Returns whether this CnxResult(T) is holding an error.
#define cnx_result_as_const(self)
Returns a const reference to the value stored in this CnxResult(T)
#define cnx_result_as_mut(self)
Returns a reference to the value stored in this CnxResult(T)
#define cnx_result_unwrap(self)
Returns the value stored in this CnxResult(T)
#define cnx_result_unwrap_or(self, default_value)
Returns the value stored in this CnxResult(T) , or default_value
#define cnx_result_unwrap_or_else(self, default_generator)
Returns the value stored in this CnxResult(T) , or default_generator()
#define cnx_result_expect(self, panic_message)
Returns the value stored in this CnxResult(T)
#define cnx_result_unwrap_err(self)
Returns the error stored in this CnxResult(T)
#define cnx_result_map(self, MapType, map_func)
Maps the value stored in this CnxResult(T)
#define cnx_result_map_or(self, map_func, default_value)
Maps the value stored in this CnxResult(T)
#define cnx_result_map_or_else(self, map_func, default_generator)
Maps the value stored in this CnxResult(T)
#define cnx_result_map_err(self, map_func)
Maps the error stored in this CnxResult(T)
#define cnx_result_and(self, result_b)
Returns result_b is self is Ok. Otherwise returns the Err value of self.
#define cnx_result_and_then(self, next_func)
Returns the result of calling next_func with the contained value if self is Ok. Otherwise, returns the Err value contained in self
#define cnx_result_or(self, result_b)
Returns self if it is Ok, otherwise returns result_b
#define cnx_result_or_else(self, func)
Returns self if it is Ok, otherwise returns the result of calling func
#define cnx_result_as_bool(self)
Converts this CnxResult(T) to a bool