| 266 | /// Returns BindResult containing typed callable, or error if not found or signature mismatch. |
| 267 | template<class Sig> |
| 268 | BindResult<Sig> get(const char* name) const { |
| 269 | fl::string key(name); |
| 270 | auto it = mRegistry.find(key); |
| 271 | if (it == mRegistry.end()) { |
| 272 | return BindResult<Sig>(fl::expected<RpcFn<Sig>, BindError>::failure(BindError::NotFound)); |
| 273 | } |
| 274 | if (it->second.mTypeTag != detail::TypeTag<Sig>::id()) { |
| 275 | return BindResult<Sig>(fl::expected<RpcFn<Sig>, BindError>::failure(BindError::SignatureMismatch)); |
| 276 | } |
| 277 | auto* holder = static_cast<detail::TypedCallableHolder<Sig>*>( |
| 278 | it->second.mTypedCallable.get()); |
| 279 | if (!holder) { |
| 280 | return BindResult<Sig>(fl::expected<RpcFn<Sig>, BindError>::failure(BindError::NotFound)); |
| 281 | } |
| 282 | return BindResult<Sig>(holder->mFn); |
| 283 | } |
| 284 | |
| 285 | /// Check if a method is registered (regardless of signature). |
| 286 | bool has(const char* name) const { |