diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-12-03 04:28:53 -0500 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-12-03 04:28:53 -0500 |
| commit | 00ba5c7cde10e0a3330d305e90cff46c0ece69e4 (patch) | |
| tree | 34e0f9782020683604b839b6436213e6531311a0 /src/kernel/NeKit/Config.h | |
| parent | b0a41001efe099f0c0bb9d16d64a81f7425edc8c (diff) | |
feat: kernel: Introduce `Error` to `ICodec` contract.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'src/kernel/NeKit/Config.h')
| -rw-r--r-- | src/kernel/NeKit/Config.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/kernel/NeKit/Config.h b/src/kernel/NeKit/Config.h index e53616a9..c9d1a62d 100644 --- a/src/kernel/NeKit/Config.h +++ b/src/kernel/NeKit/Config.h @@ -142,7 +142,8 @@ class ICodec { return class_fac.template From<OutputClass>(type); } - /// @brief Convert T class to Y class. + /// @brief Convert T to a Y type. + /// @note The class must be serializable, otherwise this will fail. /// @tparam T the class type of type. /// @tparam Y the result class. /// @param type the class to cast. @@ -150,7 +151,7 @@ class ICodec { template <typename T, typename Y> Y As(T type) { if (type.template IsSerializable()) { - return reinterpret_cast<Char*>(type); + return type.template Error(); } return type.template As<Y>(); |
