FDO2 Driver 0.1.0
API reference
Loading...
Searching...
No Matches
Public Member Functions | List of all members
fdo2::CheckedConfig Class Reference

A configuration proven valid at build time. More...

#include <fdo2_types.hpp>

Public Member Functions

consteval CheckedConfig (const Config &config) noexcept
 Check config at build time.
 
constexpr const Config & Get () const &noexcept
 
void Get () const &&=delete
 Not on a temporary: the reference would dangle (KB-CPP20-044).
 

Detailed Description

A configuration proven valid at build time.

constexpr CheckedConfig kBoard{Config{.baud = 9600}}; fails to compile, naming ConfigIsInvalid, when Validate() rejects the configuration. Pass kBoard.Get() to the driver; the driver still validates at start-up, for configurations built at run time.

Constructor & Destructor Documentation

◆ CheckedConfig()

consteval fdo2::CheckedConfig::CheckedConfig ( const Config &  config)
inlineexplicitnoexcept

Check config at build time.

Parameters
configThe configuration; it must pass Validate().

Member Function Documentation

◆ Get()

constexpr const Config & fdo2::CheckedConfig::Get ( ) const &
inlineconstexprnoexcept
Returns
The checked configuration.

The documentation for this class was generated from the following file: