junrushao commented on code in PR #36:
URL: https://github.com/apache/tvm-ffi/pull/36#discussion_r2396983805
##########
include/tvm/ffi/function_details.h:
##########
@@ -204,6 +217,39 @@ TVM_FFI_INLINE static Error MoveFromSafeCallRaised() {
TVM_FFI_INLINE static void SetSafeCallRaised(const Error& error) {
TVMFFIErrorSetRaised(details::ObjectUnsafe::TVMFFIObjectPtrFromObjectRef(error));
}
+
+template <typename T>
+struct TypeSchemaImpl {
+ static std::string v() {
+ using U = std::remove_const_t<std::remove_reference_t<T>>;
+ return TypeTraits<U>::TypeSchema();
+ }
+};
+
+template <>
+struct TypeSchemaImpl<void> {
+ static std::string v() {
+ return "{\"type\":\"" + std::string(StaticTypeKey::kTVMFFINone) + "\"}";
+ }
+};
+
+template <>
+struct TypeSchemaImpl<Any> {
+ static std::string v() { return "{\"type\":\"" +
std::string(StaticTypeKey::kTVMFFIAny) + "\"}"; }
+};
+
+template <>
+struct TypeSchemaImpl<AnyView> {
+ static std::string v() { return "{\"type\":\"" +
std::string(StaticTypeKey::kTVMFFIAny) + "\"}"; }
+};
+
+template <>
+struct TypeSchemaImpl<Function> {
Review Comment:
Good catch! I removed this particular template specialization, and this
particular case is covered under `schema_id_func` here:
https://github.com/junrushao/tvm-ffi/blob/b5af0ce82c248214ee9dbe70f981cfd45d770930/tests/cpp/test_schema.cc#L71.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]