![]() |
STX
1.0.0
|
Namespaces | |
backtrace | |
internal | |
this_thread | |
Classes | |
struct | Err |
class | FixedReport |
struct | is_equality_comparable |
struct | is_equality_comparable< T, Cmp, typename std::enable_if_t< true, decltype((std::declval< std::remove_reference_t< T > const & >()==std::declval< std::remove_reference_t< Cmp > const & >()) &&(std::declval< std::remove_reference_t< T > const & >() !=std::declval< std::remove_reference_t< Cmp > const & >()),(void) 0)> > |
struct | NoneType |
struct | Ok |
struct | Option |
class | ReportPayload |
struct | ReportQuery |
Tag type for dispatching reports. More... | |
struct | Result |
struct | Some |
struct | SourceLocation |
class | SpanReport |
Typedefs | |
template<typename Fn , typename... Args> | |
using | invoke_result = typename std::invoke_result_t< Fn, Args... > |
template<typename T > | |
using | Ref = std::reference_wrapper< T > |
template<typename T > | |
using | ConstRef = std::reference_wrapper< std::add_const_t< std::remove_reference_t< T > >> |
ConstRef is an always-const Ref . More... | |
template<typename T > | |
using | MutRef = std::reference_wrapper< std::remove_const_t< std::remove_reference_t< T > >> |
MutRef is an always-mutable Ref More... | |
using | PanicHook = decltype(panic_handler) * |
using | AtomicPanicHook = std::atomic< PanicHook > |
Functions | |
template<typename U , typename T > | |
STX_FORCE_INLINE constexpr bool | operator== (Some< U > const &cmp, Option< T > const &option) |
template<typename U , typename T > | |
STX_FORCE_INLINE constexpr bool | operator!= (Some< U > const &cmp, Option< T > const &option) |
template<typename T > | |
STX_FORCE_INLINE constexpr bool | operator== (NoneType const &, Option< T > const &option) noexcept |
template<typename T > | |
STX_FORCE_INLINE constexpr bool | operator!= (NoneType const &, Option< T > const &option) noexcept |
template<typename U , typename T , typename E > | |
STX_FORCE_INLINE constexpr bool | operator== (Ok< U > const &cmp, Result< T, E > const &result) |
template<typename U , typename T , typename E > | |
STX_FORCE_INLINE constexpr bool | operator!= (Ok< U > const &cmp, Result< T, E > const &result) |
template<typename F , typename T , typename E > | |
STX_FORCE_INLINE constexpr bool | operator== (Err< F > const &cmp, Result< T, E > const &result) |
template<typename F , typename T , typename E > | |
STX_FORCE_INLINE constexpr bool | operator!= (Err< F > const &cmp, Result< T, E > const &result) |
template<typename T > | |
STX_FORCE_INLINE constexpr auto | make_some (T value) -> Option< T > |
template<typename T > | |
STX_FORCE_INLINE constexpr auto | make_none () noexcept -> Option< T > |
template<typename T , typename E > | |
STX_FORCE_INLINE constexpr auto | make_ok (T value) -> Result< T, E > |
template<typename T , typename E > | |
STX_FORCE_INLINE constexpr auto | make_err (E err) -> Result< T, E > |
template<typename T > | |
STX_FORCE_INLINE auto | some_ref (T &value) noexcept |
template<typename T > | |
STX_FORCE_INLINE auto | ok_ref (T &value) noexcept |
template<typename E > | |
STX_FORCE_INLINE auto | err_ref (E &value) noexcept |
void | panic_abort (std::string_view const &info, ReportPayload const &payload, SourceLocation const &location) |
Causes the abort instruction to be executed. More... | |
void | panic_default (std::string_view const &info, ReportPayload const &payload, SourceLocation const &location) noexcept |
void | panic_halt (std::string_view const &info, ReportPayload const &payload, SourceLocation const &location) noexcept |
STX_EXPORT bool | panic_hook_visible () noexcept |
STX_LOCAL bool | attach_panic_hook (PanicHook hook) noexcept |
STX_LOCAL bool | take_panic_hook (PanicHook *hook) noexcept |
void | panic_handler (std::string_view const &info, ReportPayload const &payload, SourceLocation const &location) noexcept |
void | begin_panic (std::string_view const &info, ReportPayload const &payload, SourceLocation const &location) noexcept |
template<typename T > | |
STX_FORCE_INLINE void | panic (std::string_view const &info, T const &value, SourceLocation const &location=SourceLocation::current()) noexcept |
template<typename T = void> | |
STX_FORCE_INLINE void | panic (std::string_view const &info="explicit panic", SourceLocation const &location=SourceLocation::current()) noexcept |
template<typename T > | |
SpanReport | operator>> (ReportQuery, T const &) noexcept |
template<typename T > | |
FixedReport | operator>> (ReportQuery, T const *const &ptr) noexcept |
template<typename T > | |
FixedReport | operator>> (ReportQuery, T *const &ptr) noexcept |
FixedReport | operator>> (ReportQuery, int8_t const &v) noexcept |
FixedReport | operator>> (ReportQuery, uint8_t const &v) noexcept |
FixedReport | operator>> (ReportQuery, int16_t const &v) noexcept |
FixedReport | operator>> (ReportQuery, uint16_t const &v) noexcept |
FixedReport | operator>> (ReportQuery, int32_t const &v) noexcept |
FixedReport | operator>> (ReportQuery, uint32_t const &v) noexcept |
SpanReport | operator>> (ReportQuery, std::string_view const &v) noexcept |
SpanReport | operator>> (ReportQuery, std::string const &v) noexcept |
Variables | |
template<typename Fn , typename... Args> | |
constexpr bool | invocable = std::is_invocable_v<Fn, Args...> |
template<typename T > | |
constexpr bool | movable |
template<typename T > | |
constexpr bool | copy_constructible = std::is_copy_constructible_v<T> |
template<typename From , typename To > | |
constexpr bool | convertible = std::is_convertible_v<From, To> |
template<typename T , typename Cmp = T> | |
constexpr bool | equality_comparable = is_equality_comparable<T, Cmp>::value |
Checks if the type has a compatible 'operator ==' and 'operator!='. More... | |
template<typename T > | |
constexpr bool | is_reference = std::is_reference_v<T> |
constexpr NoneType const | None {} |
value-variant for Option<T> representing no-value More... | |
constexpr bool | kPanicHookVisible = false |
constexpr size_t | kReportReserveSize = 128 |
constexpr char const | kReportTruncationMessage [] |
constexpr ReportQuery const | report_query {} |
Tag value for dispatching reports. More... | |
constexpr char const | kFormatError [] = "<format error>" |
constexpr size_t const | kFormatErrorSize = sizeof(kFormatError) - 1 |
using stx::AtomicPanicHook = typedef std::atomic<PanicHook> |
using stx::ConstRef = typedef std::reference_wrapper<std::add_const_t<std::remove_reference_t<T> >> |
ConstRef
is an always-const Ref
.
using stx::invoke_result = typedef typename std::invoke_result_t<Fn, Args...> |
using stx::MutRef = typedef std::reference_wrapper<std::remove_const_t<std::remove_reference_t<T> >> |
MutRef
is an always-mutable Ref
using stx::PanicHook = typedef decltype(panic_handler)* |
using stx::Ref = typedef std::reference_wrapper<T> |
Ref
is an alias for std::reference_wrapper
Ref
can be mutable and immutable depending on the const-qualifier for T
To offer stronger guarantees prefer ConstRef
and MutRef
Attaches a new panic hook, the attached panic hook is called in place of the default panic hook.
Returns true
if the thread is not panicking and the panic hook was successfully attached, else returns false
.
Yes
|
noexcept |
Handles and dispatches the panic handler. The debugging breakpoint should be attached to this function to investigate panics.
DO NOT INVOKE THIS FUNCTION!!!
|
noexcept |
STX_FORCE_INLINE constexpr auto stx::make_err | ( | E | err | ) | -> Result<T, E> |
Helper function to construct a Result<T, E>
with an Err<E>
value. if the template parameter E
is not specified, it is auto-deduced from the parameter's value.
The value type T
must be specified and is the first template parameter.
Basic usage:
C++ 20 and above
|
noexcept |
Helper function to construct an Option<T>
with a None
value. note that the value parameter T
must be specified.
Basic usage:
C++ 20 and above
STX_FORCE_INLINE constexpr auto stx::make_ok | ( | T | value | ) | -> Result<T, E> |
Helper function to construct a Result<T, E>
with an Ok<T>
value.
The value type T
must be specified and is the first template parameter.
Basic usage:
C++ 20 and above
STX_FORCE_INLINE constexpr auto stx::make_some | ( | T | value | ) | -> Option<T> |
Helper function to construct an Option<T>
with a Some<T>
value. if the template parameter is not specified, it is auto-deduced from the parameter's value.
Basic usage:
C++ 20 and above
|
noexcept |
STX_FORCE_INLINE constexpr bool stx::operator!= | ( | Some< U > const & | cmp, |
Option< T > const & | option | ||
) |
|
noexcept |
STX_FORCE_INLINE constexpr bool stx::operator!= | ( | Ok< U > const & | cmp, |
Result< T, E > const & | result | ||
) |
STX_FORCE_INLINE constexpr bool stx::operator!= | ( | Err< F > const & | cmp, |
Result< T, E > const & | result | ||
) |
STX_FORCE_INLINE constexpr bool stx::operator== | ( | Some< U > const & | cmp, |
Option< T > const & | option | ||
) |
|
noexcept |
STX_FORCE_INLINE constexpr bool stx::operator== | ( | Ok< U > const & | cmp, |
Result< T, E > const & | result | ||
) |
STX_FORCE_INLINE constexpr bool stx::operator== | ( | Err< F > const & | cmp, |
Result< T, E > const & | result | ||
) |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
noexcept |
This allows a program to terminate immediately and provide feedback to the caller of the program. panic
should be used when a program reaches an unrecoverable state. This function is the perfect way to assert conditions in example code and in tests. panic
is closely tied with the unwrap
and expect
method of both Option
and Result
. Both implementations call panic
when they are set to None
or Err
variants.
|
noexcept |
|
inline |
Causes the abort instruction to be executed.
|
inlinenoexcept |
|
inlinenoexcept |
Causes the program, or the current thread, to halt by entering an infinite loop. You can force the program to continue via a debugger by setting the halt
value to true. after which the program will abort.
|
noexcept |
The global panic handler. It is advisable to be avoid heap memory allocation of any sort and be conscious of shared state as it can be called from mulitple threads.
|
noexcept |
Checks if panic hooks are visible to be attached-to when loaded as a dynamic library. This should be called before calling any of attach_panic_hook
or take_panic_hook
when loaded as a dynamic library.
Yes
|
noexcept |
Removes the registered panic hook (if any) and resets it to the default panic hook. hook
is set to the last-registered panic hook or the default.
Returns true
if the thread is not panicking and the panic hook was successfully taken, else returns false
.
Yes
constexpr bool stx::convertible = std::is_convertible_v<From, To> |
constexpr bool stx::copy_constructible = std::is_copy_constructible_v<T> |
constexpr bool stx::equality_comparable = is_equality_comparable<T, Cmp>::value |
Checks if the type has a compatible 'operator ==' and 'operator!='.
constexpr bool stx::invocable = std::is_invocable_v<Fn, Args...> |
constexpr bool stx::is_reference = std::is_reference_v<T> |
constexpr char const stx::kFormatError[] = "<format error>" |
constexpr size_t const stx::kFormatErrorSize = sizeof(kFormatError) - 1 |
constexpr bool stx::kPanicHookVisible = false |
constexpr size_t stx::kReportReserveSize = 128 |
constexpr char const stx::kReportTruncationMessage[] |
constexpr bool stx::movable |
constexpr ReportQuery const stx::report_query {} |
Tag value for dispatching reports.