You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
996 B
C++

// Copyright 2022, The Cozo Project Authors.
//
// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
// If a copy of the MPL was not distributed with this file,
// You can obtain one at https://mozilla.org/MPL/2.0/.
#ifndef COZOROCKS_SLICE_H
#define COZOROCKS_SLICE_H
#include "common.h"
inline Slice convert_slice(RustBytes d) {
return {reinterpret_cast<const char *>(d.data()), d.size()};
}
inline string convert_vec_to_string(const rust::Vec<uint8_t> &d) {
return {reinterpret_cast<const char *>(d.data()), d.size()};
}
inline string convert_slice_to_string(RustBytes d) {
return {reinterpret_cast<const char *>(d.data()), d.size()};
}
inline RustBytes convert_slice_back(const Slice &s) {
return {reinterpret_cast<const std::uint8_t *>(s.data()), s.size()};
}
inline RustBytes convert_pinnable_slice_back(const PinnableSlice &s) {
return {reinterpret_cast<const std::uint8_t *>(s.data()), s.size()};
}
#endif //COZOROCKS_SLICE_H