Skip to content

Commit f04fb26

Browse files
committed
naming shortened
1 parent f484202 commit f04fb26

1 file changed

Lines changed: 37 additions & 39 deletions

File tree

zenoh-flat-jni/build.rs

Lines changed: 37 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,19 @@ fn main() {
3333
// consumer below is `.expand`ed so callers pass a string or a handle in
3434
// one JNI crossing. (Exception: z_session_undeclare_keyexpr stays
3535
// handle-only — see the session package.)
36-
.combined_constructor(pq!(ZKeyExpr))
37-
.combined_variant(pq!(z_keyexpr_try_from))
38-
.combined_variant_id()
36+
.constructor(pq!(ZKeyExpr))
37+
.constructor_variant(pq!(z_keyexpr_try_from))
38+
.constructor_variant_id()
3939
// Combined ACCESSOR for ZKeyExpr (output expansion): a function
4040
// returning a key-expr handle (`.expand_output()`) is decomposed into
4141
// BOTH the handle (identity record) and its borrowed string form
4242
// (`z_keyexpr_as_str`, a zero-copy `&str → jstring`), delivered to a
4343
// zenoh-java builder lambda in one JNI crossing. zenoh-java builds its
4444
// `KeyExpr(flat, string)` directly and later sends the handle back (its
4545
// `exprSel` selects the identity arm of the combined constructor above).
46-
.combined_accessor(pq!(ZKeyExpr))
47-
.combined_accessor_record_id()
48-
.combined_accessor_record(pq!(z_keyexpr_as_str))
46+
.accessor(pq!(ZKeyExpr))
47+
.accessor_record_id()
48+
.accessor_record(pq!(z_keyexpr_as_str))
4949
.package_fun(pq!(z_keyexpr_intersects))
5050
.expand(pq!(a))
5151
.expand(pq!(b))
@@ -75,18 +75,14 @@ fn main() {
7575
.enum_class(pq!(WhatAmI))
7676
// ZZenohId is a `Copy` value (zenoh::session::ZenohId, repr(transparent)),
7777
// so it crosses as a raw byte-blob `ByteArray` rather than a closeable
78-
// jlong handle — this also lets `Vec<ZZenohId>` surface as
79-
// `List<ZZenohId>` (see z_session_peers_zid/routers_zid below).
80-
// ZZenohId is a `Copy` value (zenoh::session::ZenohId, repr(transparent)),
81-
// so it crosses as a raw byte-blob `ByteArray` rather than a closeable
8278
// jlong handle. `Vec<ZZenohId>` (z_session_peers_zid/routers_zid) folds
83-
// each element WHOLE as the typed `ZZenohId` value class (M4 Iterable,
84-
// no combined accessor). NOTE: the M5 vector-of-*unfolded* machinery
85-
// (decompose each element into e.g. `(String, ZZenohId)` via a combined
86-
// accessor with `.combined_accessor_record_id()` — a `value_blob`
87-
// identity delivered by copy) is implemented and unit-tested
88-
// (`iterable_decomposed_plan`); it's simply not wired here because the
89-
// SDK `ZenohId` stores the blob only and computes its string lazily.
79+
// each element WHOLE as the typed `ZZenohId` value class (Iterable,
80+
// no accessor). NOTE: the vector-of-*unfolded* machinery (decompose each
81+
// element into e.g. `(String, ZZenohId)` via an `.accessor(ZZenohId)`
82+
// with `.accessor_record_id()` — a `value_blob` identity delivered by
83+
// copy) is implemented and unit-tested (`iterable_decomposed_plan`); it's
84+
// simply not wired here because the SDK `ZenohId` stores the blob only
85+
// and computes its string lazily.
9086
.value_blob(pq!(ZZenohId))
9187
.package_fun(pq!(z_zenoh_id_to_bytes))
9288
.package_fun(pq!(z_zenoh_id_to_string))
@@ -114,18 +110,19 @@ fn main() {
114110
// (`const uint8_t* + size`); its JNI form is `z_zbytes_from_vec(Vec<u8>)`
115111
// above (→ `ByteArray`). The `&[u8]` slice input has no JNI representation,
116112
// so it's intentionally not exported here.
117-
// Single constructor for ZZBytes: payload/attachment params accept a
113+
// Constructor for ZZBytes: payload/attachment params accept a
118114
// `ByteArray` (built via z_zbytes_from_vec) directly — no handle, no
119-
// per-call `zZbytesFromVec` crossing. (No identity arm: the SDK never
120-
// holds a ZZBytes handle for these.)
121-
.constructor(pq!(z_zbytes_from_vec))
115+
// per-call `zZbytesFromVec` crossing. (One variant, no identity arm: the
116+
// SDK never holds a ZZBytes handle for these.)
117+
.constructor(pq!(ZZBytes))
118+
.constructor_variant(pq!(z_zbytes_from_vec))
122119
// Combined ACCESSOR for ZZBytes (output expansion): an `Option<&ZZBytes>`
123120
// return (e.g. z_sample_attachment) is decomposed into its bytes
124121
// (`z_zbytes_to_bytes` → ByteArray) and delivered to a builder lambda —
125122
// no transient handle + `close()`. No identity record (the SDK ZBytes
126123
// holds the ByteArray, not the native handle).
127-
.combined_accessor(pq!(ZZBytes))
128-
.combined_accessor_record(pq!(z_zbytes_to_bytes))
124+
.accessor(pq!(ZZBytes))
125+
.accessor_record(pq!(z_zbytes_to_bytes))
129126
.ptr_class(pq!(ZEncoding))
130127
.package_fun(pq!(z_encoding_id))
131128
.package_fun(pq!(z_encoding_schema))
@@ -135,12 +132,13 @@ fn main() {
135132
// Combined ACCESSOR for ZEncoding (output expansion): decompose to its
136133
// canonical string (`z_encoding_to_string`), nested by the ZSample
137134
// combined accessor below to build the SDK `Encoding(string)`.
138-
.combined_accessor(pq!(ZEncoding))
139-
.combined_accessor_record(pq!(z_encoding_to_string))
140-
// Single constructor for ZEncoding: encoding params accept a `String`
135+
.accessor(pq!(ZEncoding))
136+
.accessor_record(pq!(z_encoding_to_string))
137+
// Constructor for ZEncoding: encoding params accept a `String`
141138
// (built via z_encoding_from_string) directly — the SDK passes its
142139
// canonical `repr` String, no per-call `zEncodingFromString` + close.
143-
.constructor(pq!(z_encoding_from_string))
140+
.constructor(pq!(ZEncoding))
141+
.constructor_variant(pq!(z_encoding_from_string))
144142
.package_fun(pq!(z_encoding_with_schema))
145143
.package_fun(pq!(z_encoding_zenoh_bytes))
146144
.package_fun(pq!(z_encoding_zenoh_string))
@@ -205,8 +203,8 @@ fn main() {
205203
// to a builder lambda — no second `zTimestampNtp64` crossing, no
206204
// transient handle. No identity record (zenoh-java's TimeStamp keeps the
207205
// Long, not the native handle).
208-
.combined_accessor(pq!(ZTimestamp))
209-
.combined_accessor_record(pq!(z_timestamp_ntp64))
206+
.accessor(pq!(ZTimestamp))
207+
.accessor_record(pq!(z_timestamp_ntp64))
210208
.package("sample")
211209
.enum_class(pq!(SampleKind))
212210
.ptr_class(pq!(ZSample))
@@ -228,16 +226,16 @@ fn main() {
228226
// nullable) combined accessors, plus enum leaves (kind/priority/
229227
// congestion → Int) and `express` (bool). Record order = builder arg
230228
// order. Used by `z_reply_sample` below to build a full SDK `Sample`.
231-
.combined_accessor(pq!(ZSample))
232-
.combined_accessor_record_nested(pq!(z_sample_key_expr)) // → (ZKeyExpr, String)
233-
.combined_accessor_record_nested(pq!(z_sample_payload)) // → ByteArray
234-
.combined_accessor_record_nested(pq!(z_sample_encoding)) // → String
235-
.combined_accessor_record(pq!(z_sample_kind)) // enum → Int
236-
.combined_accessor_record_nested(pq!(z_sample_timestamp)) // Option → Long?
237-
.combined_accessor_record(pq!(z_sample_express)) // bool → Boolean
238-
.combined_accessor_record(pq!(z_sample_priority)) // enum → Int
239-
.combined_accessor_record(pq!(z_sample_congestion_control)) // enum → Int
240-
.combined_accessor_record_nested(pq!(z_sample_attachment)) // Option → ByteArray?
229+
.accessor(pq!(ZSample))
230+
.accessor_record_nested(pq!(z_sample_key_expr)) // → (ZKeyExpr, String)
231+
.accessor_record_nested(pq!(z_sample_payload)) // → ByteArray
232+
.accessor_record_nested(pq!(z_sample_encoding)) // → String
233+
.accessor_record(pq!(z_sample_kind)) // enum → Int
234+
.accessor_record_nested(pq!(z_sample_timestamp)) // Option → Long?
235+
.accessor_record(pq!(z_sample_express)) // bool → Boolean
236+
.accessor_record(pq!(z_sample_priority)) // enum → Int
237+
.accessor_record(pq!(z_sample_congestion_control)) // enum → Int
238+
.accessor_record_nested(pq!(z_sample_attachment)) // Option → ByteArray?
241239
.package("pubsub")
242240
.ptr_class(pq!(ZPublisher))
243241
.package_fun(pq!(z_publisher_put))

0 commit comments

Comments
 (0)