struct DynError

Declaration

struct DynError { /* full declaration omitted */ };

Description

A type-erased [`Error`]($sus::error::Error) object. `DynError` also satisfies [`Error`]($sus::error::Error) itself. Using this allows the error type to be placed in heap-allocated smart pointers without templates, and thus without knowing the concrete type. For example a `void foo(Box <DynError >)` function can work with any [`Error`]($sus::error::Error) type but does not need to be templated. This allows the function to be virtual, to reduce complilation time/binary size, or to provide dynamically linked library ABI. Since it is type erased, it must only be referred to by reference/pointer, and it can not be moved similar to [`Pin <T >`](https://doc.rust-lang.org/std/pin/struct.Pin.html) types in Rust. See [`DynConcept`]($sus::boxed::DynConcept) for more on type erasure of concept-satisfying types.

Declared at: sus/error/error.h:445

Method Overview

  • public DynError()
  • public DynError(sus::error::DynError &&)
  • public virtual std::string display() const noexcept
  • public virtual sus::Option<const DynError &> source() const noexcept
  • public virtual ~DynError()

Methods

DynError()

Description

#[doc.hidden]

Declared at: sus/error/error.h:454

DynError(sus::error::DynError&&)

Declared at: sus/error/error.h:457

Parameters

sus::error::DynError&&

virtual std::string display() const noexcept

Description

Forwards to the [`Error`]($sus::error::Error) implementation of `E`.

Declared at: sus/error/error.h:447

virtual sus::Option<const DynError&> source()
    const noexcept

Description

Forwards to the [`Error`]($sus::error::Error) implementation of `E`.

Declared at: sus/error/error.h:449

virtual ~DynError()

Description

#[doc.hidden]

Declared at: sus/error/error.h:456