Skip to content

Commit b3d66b8

Browse files
authored
kj-rs update, using conversions from the library (#4447)
1 parent 56dbb67 commit b3d66b8

File tree

10 files changed

+28
-130
lines changed

10 files changed

+28
-130
lines changed

build/deps/gen/dep_capnp_cpp.bzl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
load("@//:build/http.bzl", "http_archive")
44

5-
URL = "https://github.com/capnproto/capnproto/tarball/6908704a0729fc202e97c3f31644fff5771bad6f"
6-
STRIP_PREFIX = "capnproto-capnproto-6908704/c++"
7-
SHA256 = "f6942780061a1a45a89f22e90f3c3496b648e261c14cf452499d6984d07dff99"
5+
URL = "https://github.com/capnproto/capnproto/tarball/5b8cae919e37898d47290e5edd777e1aa6be802a"
6+
STRIP_PREFIX = "capnproto-capnproto-5b8cae9/c++"
7+
SHA256 = "bb508a1762ca4af7b01162c38a2153e4b77595f612aeb27d2b560cc16302bf14"
88
TYPE = "tgz"
9-
COMMIT = "6908704a0729fc202e97c3f31644fff5771bad6f"
9+
COMMIT = "5b8cae919e37898d47290e5edd777e1aa6be802a"
1010

1111
def dep_capnp_cpp():
1212
http_archive(

build/deps/gen/dep_workerd_cxx.bzl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
load("@//:build/http.bzl", "http_archive")
44

5-
URL = "https://github.com/cloudflare/workerd-cxx/tarball/33a35299d325c744edbb58da39e6f29eed42b024"
6-
STRIP_PREFIX = "cloudflare-workerd-cxx-33a3529"
7-
SHA256 = "a9749efd3d8e60c1a5e02d138eab6caa1eabe565e97acb69022d19770217a26d"
5+
URL = "https://github.com/cloudflare/workerd-cxx/tarball/832fbf026db0d6efcaa48f7ad3aa23044d41a73c"
6+
STRIP_PREFIX = "cloudflare-workerd-cxx-832fbf0"
7+
SHA256 = "bb1d8ef5fee85ced8be67bc0b5e06d32e2b8b8c4973bd75a1ca7b4f676cfcaae"
88
TYPE = "tgz"
9-
COMMIT = "33a35299d325c744edbb58da39e6f29eed42b024"
9+
COMMIT = "832fbf026db0d6efcaa48f7ad3aa23044d41a73c"
1010

1111
def dep_workerd_cxx():
1212
http_archive(

src/rust/cxx-integration-test/cxx-rust-integration-test.c++

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
#include <kj/async.h>
88
#include <kj/test.h>
9+
#include <kj-rs/kj-rs.h>
10+
11+
using namespace kj_rs;
912

1013
// Test generic rust/c++ integration boundary.
1114
// See src/rust/cxx-integration-tests for rust backend.

src/rust/cxx-integration/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ wd_rust_crate(
1010
deps = [
1111
"@crates_vendor//:tokio",
1212
"@crates_vendor//:tracing",
13+
"@workerd-cxx//kj-rs",
1314
],
1415
)
1516

src/rust/cxx-integration/cxx-bridge.h

Lines changed: 0 additions & 109 deletions
This file was deleted.

src/rust/cxx-integration/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ mod ffi {
77

88
fn trigger_panic(msg: &str);
99
}
10-
11-
unsafe extern "C++" {
12-
include!("workerd/rust/cxx-integration/cxx-bridge.h");
13-
}
1410
}
1511

1612
pub fn init() {

src/rust/gen-compile-cache/cxx-bridge.c++

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
#include <workerd/jsg/type-wrapper.h>
55
#include <workerd/jsg/setup.h>
66

7-
#include <workerd/rust/cxx-integration/lib.rs.h>
8-
97
#include <capnp/serialize.h>
8+
#include <kj-rs/kj-rs.h>
109

10+
using namespace kj_rs;
1111
namespace workerd::rust::gen_compile_cache {
1212

1313
namespace {
@@ -36,11 +36,11 @@ constexpr v8::ScriptCompiler::CompileOptions compileOptions = v8::ScriptCompiler
3636
auto data = ccIsolate.runInLockScope([&](CompileCacheIsolate::Lock& isolateLock) {
3737
return JSG_WITHIN_CONTEXT_SCOPE(isolateLock,
3838
isolateLock.newContext<CompilerCacheContext>().getHandle(isolateLock), [&](jsg::Lock& js) {
39-
auto resourceName = jsg::newExternalOneByteString(js, fromRust(path));
39+
auto resourceName = jsg::newExternalOneByteString(js, from<Rust>(path));
4040
v8::ScriptOrigin origin(resourceName, resourceLineOffset, resourceColumnOffset,
4141
resourceIsSharedCrossOrigin, scriptId, {}, resourceIsOpaque, isWasm, isModule);
4242

43-
auto contentStr = jsg::newExternalOneByteString(js, fromRust(source));
43+
auto contentStr = jsg::newExternalOneByteString(js, from<Rust>(source));
4444
auto source = v8::ScriptCompiler::Source(contentStr, origin, nullptr);
4545
auto module =
4646
jsg::check(v8::ScriptCompiler::CompileModule(js.v8Isolate, &source, compileOptions));

src/rust/python-parser/import_parsing.c++

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
// https://opensource.org/licenses/Apache-2.0
44

55
#include <workerd/rust/python-parser/lib.rs.h>
6-
#include "workerd/rust/cxx-integration/lib.rs.h"
7-
6+
#include <kj-rs/kj-rs.h>
87
#include <kj/test.h>
98

9+
using namespace kj_rs;
10+
1011
using ::edgeworker::rust::python_parser::get_imports;
1112

1213
kj::Array<kj::String> parseImports(kj::ArrayPtr<kj::StringPtr> cpp_modules) {
@@ -16,7 +17,7 @@ kj::Array<kj::String> parseImports(kj::ArrayPtr<kj::StringPtr> cpp_modules) {
1617
}
1718
::rust::Slice<::rust::Str const> rust_slice(rust_modules.begin(), rust_modules.size());
1819
auto rust_result = get_imports(rust_slice);
19-
return workerd::fromRust(rust_result);
20+
return from<RustCopy>(rust_result);
2021
}
2122

2223
namespace workerd::api {

src/workerd/api/node/dns.c++

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44
#include "dns.h"
55

66
#include <workerd/jsg/exception.h>
7-
#include <workerd/rust/cxx-integration/cxx-bridge.h>
87
#include <workerd/rust/dns/lib.rs.h>
98

9+
#include <kj-rs/kj-rs.h>
10+
11+
using namespace kj_rs;
12+
1013
namespace workerd::api::node {
1114

1215
DnsUtil::CaaRecord DnsUtil::parseCaaRecord(kj::String record) {

src/workerd/api/node/url.c++

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@
55

66
#include "ada.h"
77

8-
#include <workerd/rust/cxx-integration/cxx-bridge.h>
98
#include <workerd/rust/net/lib.rs.h>
109

10+
#include <kj-rs/kj-rs.h>
11+
12+
using namespace kj_rs;
13+
1114
namespace workerd::api::node {
1215

1316
namespace {

0 commit comments

Comments
 (0)