mirror of
https://github.com/huggingface/text-generation-inference.git
synced 2025-04-22 23:42:06 +00:00
(ffi) add template specialization to catch and convert to Rust Result<T, tensorrt_llm::common::TllmException>
This commit is contained in:
parent
33c962ef41
commit
5f7c0b67c3
@ -14,6 +14,18 @@ namespace huggingface::tgi::backends {
|
|||||||
class TensorRtLlmBackendImpl;
|
class TensorRtLlmBackendImpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Template to support returning error from TllmException back to Rust in a Result<>
|
||||||
|
#include <tensorrt_llm/common/tllmException.h>
|
||||||
|
|
||||||
|
namespace rust::behavior {
|
||||||
|
template<typename Try, typename Fail>
|
||||||
|
static void trycatch(Try &&func, Fail &&fail) noexcept try {
|
||||||
|
func();
|
||||||
|
} catch (tensorrt_llm::common::TllmException &e) {
|
||||||
|
fail(e.what());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#include "backends/trtllm/src/lib.rs.h"
|
#include "backends/trtllm/src/lib.rs.h"
|
||||||
|
|
||||||
namespace huggingface::tgi::backends {
|
namespace huggingface::tgi::backends {
|
||||||
|
Loading…
Reference in New Issue
Block a user