rustorb 0.2.0__tar.gz → 0.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {rustorb-0.2.0 → rustorb-0.4.0}/Cargo.lock +18 -17
- {rustorb-0.2.0 → rustorb-0.4.0}/Cargo.toml +6 -6
- {rustorb-0.2.0 → rustorb-0.4.0}/PKG-INFO +1 -1
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-cdr/src/encoder.rs +58 -4
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-cdr/src/value.rs +2 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-cdr/src/xcdr.rs +1 -1
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/src/connection.rs +260 -29
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/src/lib.rs +4 -4
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/src/object.rs +143 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/src/orb.rs +157 -13
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/src/pi.rs +1 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/src/poa.rs +18 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/src/policy.rs +73 -16
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/src/server.rs +302 -29
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/src/typecode/cdr.rs +4 -0
- rustorb-0.4.0/crates/rustorb-core/tests/ami.rs +357 -0
- rustorb-0.4.0/crates/rustorb-core/tests/bidir.rs +487 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/tests/pi.rs +66 -23
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/tests/stress.rs +13 -1
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/tests/trace.rs +1 -1
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-giop/src/lib.rs +3 -1
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-giop/src/service_context.rs +113 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-giop/src/writer.rs +78 -4
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-giop/tests/giop.rs +111 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-python/src/orb.rs +210 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-python/src/poa.rs +7 -5
- {rustorb-0.2.0 → rustorb-0.4.0}/pyproject.toml +1 -1
- rustorb-0.4.0/rustorb/BiDirPolicy.py +38 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/rustorb/CORBA.py +14 -0
- rustorb-0.4.0/rustorb/Messaging.py +191 -0
- rustorb-0.4.0/rustorb/Messaging__POA.py +15 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/rustorb/_native.pyi +2 -0
- rustorb-0.2.0/rustorb/Messaging.py +0 -26
- {rustorb-0.2.0 → rustorb-0.4.0}/README.md +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-cdr/Cargo.toml +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-cdr/LICENSE-APACHE +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-cdr/LICENSE-MIT +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-cdr/README.md +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-cdr/src/decoder.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-cdr/src/error.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-cdr/src/lib.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-cdr/src/long_double.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-cdr/src/octets.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-cdr/src/traits.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-cdr/tests/cdr.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-cdr/tests/xcdr.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/Cargo.toml +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/LICENSE-APACHE +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/LICENSE-MIT +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/README.md +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/benches/throughput.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/src/codeset.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/src/dii.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/src/dynany/mod.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/src/dynany/tests.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/src/exception.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/src/fixed.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/src/idl/abstract_iface.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/src/idl/mod.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/src/idl/tests.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/src/idl/value.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/src/idle.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/src/iop.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/src/name.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/src/pool.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/src/servant.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/src/stream.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/src/timeout.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/src/tls.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/src/trace.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/src/typecode/mod.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/src/typecode/tests.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/src/value.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/src/wire.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/tests/any.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/tests/async_api.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/tests/client.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/tests/connections.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/tests/dii.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/tests/message_size.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/tests/poa.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/tests/policy.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/tests/server.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/tests/soak.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/tests/tls/ca.pem +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/tests/tls/client-bundle.pem +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/tests/tls/client.key +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/tests/tls/client.pem +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/tests/tls/make-certs.sh +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/tests/tls/other-ca.pem +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/tests/tls/other-server.key +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/tests/tls/other-server.pem +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/tests/tls/server-bundle.pem +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/tests/tls/server.key +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/tests/tls/server.pem +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/tests/tls/wrong-name.key +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/tests/tls/wrong-name.pem +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/tests/tls.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-core/tests/valuetype.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-giop/Cargo.toml +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-giop/LICENSE-APACHE +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-giop/LICENSE-MIT +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-giop/README.md +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-giop/src/component.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-giop/src/corbaloc.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-giop/src/error.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-giop/src/fragment.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-giop/src/header.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-giop/src/iiop.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-giop/src/ior.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-giop/src/message.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-giop/tests/ior.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-giop/tests/omniorb_golden.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-python/Cargo.toml +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-python/LICENSE-APACHE +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-python/LICENSE-MIT +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-python/README.md +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-python/build.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-python/src/any.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-python/src/dii.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-python/src/dynany.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-python/src/error.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-python/src/lib.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-python/src/log.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-python/src/pi.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-python/src/tc.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/crates/rustorb-python/src/value.rs +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/rustorb/DynamicAny.py +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/rustorb/IOP.py +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/rustorb/PortableInterceptor.py +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/rustorb/PortableServer.py +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/rustorb/PortableServer__POA.py +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/rustorb/TimeBase.py +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/rustorb/__init__.py +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/rustorb/_log.py +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/rustorb/_rt.py +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/rustorb/_types.py +0 -0
- {rustorb-0.2.0 → rustorb-0.4.0}/rustorb/timeouts.py +0 -0
|
@@ -438,20 +438,11 @@ dependencies = [
|
|
|
438
438
|
|
|
439
439
|
[[package]]
|
|
440
440
|
name = "rustorb-cdr"
|
|
441
|
-
version = "0.
|
|
442
|
-
|
|
443
|
-
[[package]]
|
|
444
|
-
name = "rustorb-codegen"
|
|
445
|
-
version = "0.2.0"
|
|
446
|
-
dependencies = [
|
|
447
|
-
"rustorb-core",
|
|
448
|
-
"rustorb-typesupport",
|
|
449
|
-
"tokio",
|
|
450
|
-
]
|
|
441
|
+
version = "0.4.0"
|
|
451
442
|
|
|
452
443
|
[[package]]
|
|
453
444
|
name = "rustorb-core"
|
|
454
|
-
version = "0.
|
|
445
|
+
version = "0.4.0"
|
|
455
446
|
dependencies = [
|
|
456
447
|
"criterion",
|
|
457
448
|
"libc",
|
|
@@ -466,15 +457,16 @@ dependencies = [
|
|
|
466
457
|
|
|
467
458
|
[[package]]
|
|
468
459
|
name = "rustorb-ffi"
|
|
469
|
-
version = "0.
|
|
460
|
+
version = "0.4.0"
|
|
470
461
|
dependencies = [
|
|
471
462
|
"rustorb-cdr",
|
|
472
463
|
"rustorb-core",
|
|
464
|
+
"tokio",
|
|
473
465
|
]
|
|
474
466
|
|
|
475
467
|
[[package]]
|
|
476
468
|
name = "rustorb-giop"
|
|
477
|
-
version = "0.
|
|
469
|
+
version = "0.4.0"
|
|
478
470
|
dependencies = [
|
|
479
471
|
"rustorb-cdr",
|
|
480
472
|
"serde_json",
|
|
@@ -482,22 +474,31 @@ dependencies = [
|
|
|
482
474
|
|
|
483
475
|
[[package]]
|
|
484
476
|
name = "rustorb-interop"
|
|
485
|
-
version = "0.
|
|
477
|
+
version = "0.4.0"
|
|
486
478
|
dependencies = [
|
|
487
479
|
"rustorb-core",
|
|
488
480
|
"rustorb-naming",
|
|
489
481
|
]
|
|
490
482
|
|
|
483
|
+
[[package]]
|
|
484
|
+
name = "rustorb-mapping-tests"
|
|
485
|
+
version = "0.0.0"
|
|
486
|
+
dependencies = [
|
|
487
|
+
"rustorb-core",
|
|
488
|
+
"rustorb-typesupport",
|
|
489
|
+
"tokio",
|
|
490
|
+
]
|
|
491
|
+
|
|
491
492
|
[[package]]
|
|
492
493
|
name = "rustorb-naming"
|
|
493
|
-
version = "0.
|
|
494
|
+
version = "0.4.0"
|
|
494
495
|
dependencies = [
|
|
495
496
|
"rustorb-core",
|
|
496
497
|
]
|
|
497
498
|
|
|
498
499
|
[[package]]
|
|
499
500
|
name = "rustorb-python"
|
|
500
|
-
version = "0.
|
|
501
|
+
version = "0.4.0"
|
|
501
502
|
dependencies = [
|
|
502
503
|
"pyo3",
|
|
503
504
|
"pyo3-build-config",
|
|
@@ -507,7 +508,7 @@ dependencies = [
|
|
|
507
508
|
|
|
508
509
|
[[package]]
|
|
509
510
|
name = "rustorb-typesupport"
|
|
510
|
-
version = "0.
|
|
511
|
+
version = "0.4.0"
|
|
511
512
|
dependencies = [
|
|
512
513
|
"rustorb-cdr",
|
|
513
514
|
]
|
|
@@ -3,7 +3,7 @@ resolver = "3"
|
|
|
3
3
|
members = ["crates/rustorb-cdr", "crates/rustorb-giop", "crates/rustorb-core", "crates/rustorb-python"]
|
|
4
4
|
|
|
5
5
|
[workspace.package]
|
|
6
|
-
version = "0.
|
|
6
|
+
version = "0.4.0"
|
|
7
7
|
edition = "2024"
|
|
8
8
|
rust-version = "1.85"
|
|
9
9
|
license = "MIT OR Apache-2.0"
|
|
@@ -13,11 +13,11 @@ keywords = ["corba", "giop", "iiop", "orb", "rpc"]
|
|
|
13
13
|
categories = ["network-programming"]
|
|
14
14
|
|
|
15
15
|
[workspace.dependencies]
|
|
16
|
-
rustorb-cdr = { path = "crates/rustorb-cdr", version = "0.
|
|
17
|
-
rustorb-typesupport = { path = "crates/rustorb-typesupport", version = "0.
|
|
18
|
-
rustorb-giop = { path = "crates/rustorb-giop", version = "0.
|
|
19
|
-
rustorb-core = { path = "crates/rustorb-core", version = "0.
|
|
20
|
-
rustorb-naming = { path = "crates/rustorb-naming", version = "0.
|
|
16
|
+
rustorb-cdr = { path = "crates/rustorb-cdr", version = "0.4.0" }
|
|
17
|
+
rustorb-typesupport = { path = "crates/rustorb-typesupport", version = "0.4.0" }
|
|
18
|
+
rustorb-giop = { path = "crates/rustorb-giop", version = "0.4.0" }
|
|
19
|
+
rustorb-core = { path = "crates/rustorb-core", version = "0.4.0" }
|
|
20
|
+
rustorb-naming = { path = "crates/rustorb-naming", version = "0.4.0" }
|
|
21
21
|
tokio = { version = "1", default-features = false }
|
|
22
22
|
|
|
23
23
|
[workspace.lints.rust]
|
|
@@ -30,6 +30,12 @@ pub struct Encoder {
|
|
|
30
30
|
/// The valuetypes written so far (for indirections) and the chunk
|
|
31
31
|
/// being written; made with the first value.
|
|
32
32
|
pub(crate) values: Option<Box<crate::value::WriteState>>,
|
|
33
|
+
/// The 8-byte alignment points written since
|
|
34
|
+
/// [`track_align8`](Encoder::track_align8), each as the buffer length
|
|
35
|
+
/// before its padding and the padding written; `None` when not
|
|
36
|
+
/// tracked, or when something was written whose bytes depend on
|
|
37
|
+
/// stream offsets (see [`take_align8`](Encoder::take_align8)).
|
|
38
|
+
align8: Option<Vec<(usize, usize)>>,
|
|
33
39
|
}
|
|
34
40
|
|
|
35
41
|
macro_rules! write_number {
|
|
@@ -66,6 +72,7 @@ impl Encoder {
|
|
|
66
72
|
origin: 0,
|
|
67
73
|
wstring_bom: true,
|
|
68
74
|
values: None,
|
|
75
|
+
align8: None,
|
|
69
76
|
}
|
|
70
77
|
}
|
|
71
78
|
|
|
@@ -96,10 +103,48 @@ impl Encoder {
|
|
|
96
103
|
}
|
|
97
104
|
|
|
98
105
|
/// The stream offset of the next byte.
|
|
106
|
+
///
|
|
107
|
+
/// A caller that writes bytes depending on it (an offset or an
|
|
108
|
+
/// indirection) calls [`pin`](Encoder::pin) as well.
|
|
99
109
|
pub fn position(&self) -> usize {
|
|
110
|
+
self.offset()
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/// The stream offset of the next byte.
|
|
114
|
+
pub(crate) fn offset(&self) -> usize {
|
|
100
115
|
self.base + self.len()
|
|
101
116
|
}
|
|
102
117
|
|
|
118
|
+
/// Starts recording where the stream is aligned to 8 bytes, so that
|
|
119
|
+
/// the bytes written from here on can be moved by 4 bytes with
|
|
120
|
+
/// [`take_align8`](Encoder::take_align8). Only for GIOP encodings;
|
|
121
|
+
/// recording stops for good when something is written whose bytes
|
|
122
|
+
/// depend on stream offsets: a valuetype, a call to
|
|
123
|
+
/// [`pin`](Encoder::pin), [`set_origin`](Encoder::set_origin),
|
|
124
|
+
/// [`as_bytes_mut`](Encoder::as_bytes_mut) or
|
|
125
|
+
/// [`truncate`](Encoder::truncate).
|
|
126
|
+
pub fn track_align8(&mut self) {
|
|
127
|
+
self.align8 = self.encoding.is_giop().then(Vec::new);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/// Stops recording, and returns the 8-byte alignment points written
|
|
131
|
+
/// since [`track_align8`](Encoder::track_align8): each is the buffer
|
|
132
|
+
/// length before its padding and the length of that padding. Data
|
|
133
|
+
/// whose alignment is at most 4 does not depend on the stream offset
|
|
134
|
+
/// modulo 8, so the bytes written since can be moved by 4 bytes by
|
|
135
|
+
/// recomputing the padding at these points alone. `None` if not
|
|
136
|
+
/// recording, or if recording stopped.
|
|
137
|
+
pub fn take_align8(&mut self) -> Option<Vec<(usize, usize)>> {
|
|
138
|
+
self.align8.take()
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/// Says that bytes written from here on depend on stream offsets, as
|
|
142
|
+
/// an indirection does, so the stream cannot be moved: stops
|
|
143
|
+
/// [`track_align8`](Encoder::track_align8) for good.
|
|
144
|
+
pub fn pin(&mut self) {
|
|
145
|
+
self.align8 = None;
|
|
146
|
+
}
|
|
147
|
+
|
|
103
148
|
/// Bytes written so far, shared octets included.
|
|
104
149
|
pub fn len(&self) -> usize {
|
|
105
150
|
self.buf.len() + self.shared_len
|
|
@@ -120,12 +165,14 @@ impl Encoder {
|
|
|
120
165
|
/// buffer indexes, which differ from stream offsets after shared
|
|
121
166
|
/// octets.
|
|
122
167
|
pub fn as_bytes_mut(&mut self) -> &mut [u8] {
|
|
168
|
+
self.align8 = None;
|
|
123
169
|
&mut self.buf
|
|
124
170
|
}
|
|
125
171
|
|
|
126
172
|
/// Drops bytes past `len`, which must not be before shared octets.
|
|
127
173
|
pub fn truncate(&mut self, len: usize) {
|
|
128
174
|
debug_assert!(self.shared.last().is_none_or(|(at, _)| *at <= len));
|
|
175
|
+
self.align8 = None;
|
|
129
176
|
self.buf.truncate(len);
|
|
130
177
|
}
|
|
131
178
|
|
|
@@ -175,9 +222,15 @@ impl Encoder {
|
|
|
175
222
|
/// [`set_origin`](Encoder::set_origin)).
|
|
176
223
|
pub fn align(&mut self, align: usize) {
|
|
177
224
|
let align = align.min(self.encoding.max_align());
|
|
178
|
-
let rem = (self.
|
|
179
|
-
if rem
|
|
180
|
-
|
|
225
|
+
let rem = (self.offset() - self.origin) % align;
|
|
226
|
+
let pad = if rem == 0 { 0 } else { align - rem };
|
|
227
|
+
if align == 8 {
|
|
228
|
+
if let Some(points) = self.align8.as_mut() {
|
|
229
|
+
points.push((self.buf.len(), pad));
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
if pad != 0 {
|
|
233
|
+
self.buf.resize(self.buf.len() + pad, 0);
|
|
181
234
|
}
|
|
182
235
|
}
|
|
183
236
|
|
|
@@ -192,7 +245,8 @@ impl Encoder {
|
|
|
192
245
|
/// `PUSH(ORIGIN)`; the parameter headers of
|
|
193
246
|
/// [`begin_parameter`](Encoder::begin_parameter) do it themselves.
|
|
194
247
|
pub fn set_origin(&mut self, origin: usize) {
|
|
195
|
-
debug_assert!(origin <= self.
|
|
248
|
+
debug_assert!(origin <= self.offset());
|
|
249
|
+
self.align8 = None;
|
|
196
250
|
self.origin = origin;
|
|
197
251
|
}
|
|
198
252
|
|
|
@@ -100,6 +100,8 @@ impl Encoder {
|
|
|
100
100
|
///
|
|
101
101
|
/// A value nested in a chunked value is chunked as well.
|
|
102
102
|
pub fn begin_value(&mut self, key: u64, ids: &[&str], chunked: bool) -> Result<bool> {
|
|
103
|
+
// Chunk lengths and indirections depend on stream offsets.
|
|
104
|
+
self.pin();
|
|
103
105
|
let state = self.values.get_or_insert_with(Default::default);
|
|
104
106
|
if let Some(&tag_at) = state.written.get(&key) {
|
|
105
107
|
self.write_u32(INDIRECTION);
|