mirror of
https://github.com/halleysfifthinc/AVCLAN-Mockingboard.git
synced 2026-08-11 08:22:52 +00:00
5208e083f3
- Peripheral::read/send now return `expected<unique_ptr<Frame>, Error>` for a unified success/error interface. - Peripheral::route returns `expected<unique_ptr<Frame>, Error>` to distinguish intent: (intentional) non-response vs unable to respond - Other functions with optional message semantics (handle,poll,react) return a unique_ptr whose ownership-state indicates response intent (i.e. send new message) Bundled necessary changes: - Switch Frame allocation from global to local (enabled via member function new/delete) - Add new header-library tl::expected to shim avr-libstdcpp Unrelated: Defensive `continue` added after `route`, to reduce Bus activity check latency Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
26 lines
685 B
C++
26 lines
685 B
C++
// Copyright (C) 2026 Allen Hill <allenofthehills@gmail.com>
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
#pragma once
|
|
|
|
#include <version>
|
|
|
|
#if !defined(__cpp_lib_expected) || __cpp_lib_expected < 202211L
|
|
#include <tl/expected.hpp>
|
|
|
|
namespace avclan {
|
|
template <class T, class E> using expected = tl::expected<T, E>;
|
|
template <class E> using unexpected = tl::unexpected<E>;
|
|
using tl::unexpect;
|
|
using tl::unexpect_t;
|
|
} // namespace avclan
|
|
#else
|
|
#include <expected>
|
|
|
|
namespace avclan {
|
|
template <class T, class E> using expected = std::expected<T, E>;
|
|
template <class E> using unexpected = std::unexpected<E>;
|
|
using std::unexpect;
|
|
using std::unexpect_t;
|
|
} // namespace avclan
|
|
#endif
|