mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-29 06:13:20 +00:00
6ede7f8009
We don't want it in Rust. Remove it to smoothen the transition.
23 lines
694 B
C++
23 lines
694 B
C++
#include <algorithm>
|
|
#include <memory>
|
|
|
|
#include "cxx.h"
|
|
#include "trace.rs.h"
|
|
#if INCLUDE_RUST_HEADERS
|
|
// For some unknown reason, the definition of rust::Box is in this particular header:
|
|
#include "parse_constants.rs.h"
|
|
#endif
|
|
|
|
template <typename T>
|
|
inline std::shared_ptr<T> box_to_shared_ptr(rust::Box<T> &&value) {
|
|
T *ptr = value.into_raw();
|
|
std::shared_ptr<T> shared(ptr, [](T *ptr) { rust::Box<T>::from_raw(ptr); });
|
|
return shared;
|
|
}
|
|
|
|
inline static void trace_if_enabled(const parser_t &parser, wcharz_t command,
|
|
const std::vector<wcstring> &args = {}) {
|
|
if (trace_enabled(parser)) {
|
|
trace_argv(parser, command, args);
|
|
}
|
|
}
|