@@ -37,28 +37,28 @@ fn main() {
3737 . constructor_variant ( pq ! ( z_keyexpr_try_from) )
3838 . constructor_variant_id ( )
3939 // Combined ACCESSOR for ZKeyExpr (output expansion): a function
40- // returning a key-expr handle (`.expand_output ()`) is decomposed into
40+ // returning a key-expr handle (`.deconstruct_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- . accessor ( pq ! ( ZKeyExpr ) )
47- . accessor_record_id ( )
48- . accessor_record ( pq ! ( z_keyexpr_as_str) )
46+ . deconstructor ( pq ! ( ZKeyExpr ) )
47+ . deconstructor_record_id ( )
48+ . deconstructor_record ( pq ! ( z_keyexpr_as_str) )
4949 . package_fun ( pq ! ( z_keyexpr_intersects) )
50- . expand ( pq ! ( a) )
51- . expand ( pq ! ( b) )
50+ . construct ( pq ! ( a) )
51+ . construct ( pq ! ( b) )
5252 . package_fun ( pq ! ( z_keyexpr_includes) )
53- . expand ( pq ! ( a) )
54- . expand ( pq ! ( b) )
53+ . construct ( pq ! ( a) )
54+ . construct ( pq ! ( b) )
5555 . package_fun ( pq ! ( z_keyexpr_relation_to) )
56- . expand ( pq ! ( a) )
57- . expand ( pq ! ( b) )
56+ . construct ( pq ! ( a) )
57+ . construct ( pq ! ( b) )
5858 . package_fun ( pq ! ( z_keyexpr_join) ) // b is a String, only `a` is a key-expr
59- . expand ( pq ! ( a) )
59+ . construct ( pq ! ( a) )
6060 . package_fun ( pq ! ( z_keyexpr_concat) ) // b is a String, only `a` is a key-expr
61- . expand ( pq ! ( a) )
61+ . construct ( pq ! ( a) )
6262 . package_fun ( pq ! ( z_keyexpr_clone) )
6363 . package_fun ( pq ! ( z_keyexpr_to_string) )
6464 . enum_class ( pq ! ( SetIntersectionLevel ) )
@@ -78,8 +78,8 @@ fn main() {
7878 // jlong handle. `Vec<ZZenohId>` (z_session_peers_zid/routers_zid) folds
7979 // each element WHOLE as the typed `ZZenohId` value class (Iterable,
8080 // 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
81+ // element into e.g. `(String, ZZenohId)` via an `.deconstructor (ZZenohId)`
82+ // with `.deconstructor_record_id ()` — a `value_blob` identity delivered by
8383 // copy) is implemented and unit-tested (`iterable_decomposed_plan`); it's
8484 // simply not wired here because the SDK `ZenohId` stores the blob only
8585 // and computes its string lazily.
@@ -116,24 +116,22 @@ fn main() {
116116 // SDK never holds a ZZBytes handle for these.)
117117 . constructor ( pq ! ( ZZBytes ) )
118118 . constructor_variant ( pq ! ( z_zbytes_from_vec) )
119- // Combined ACCESSOR for ZZBytes (output expansion): an `Option<&ZZBytes>`
120- // return (e.g. z_sample_attachment) is decomposed into its bytes
121- // (`z_zbytes_to_bytes` → ByteArray) and delivered to a builder lambda —
122- // no transient handle + `close()`. No identity record (the SDK ZBytes
123- // holds the ByteArray, not the native handle).
124- . accessor ( pq ! ( ZZBytes ) )
125- . accessor_record ( pq ! ( z_zbytes_to_bytes) )
119+ // CONVERTER for ZZBytes (single-value deconstructor): an `Option<&ZZBytes>`
120+ // return (z_sample_attachment) is converted to its bytes
121+ // (`z_zbytes_to_bytes` → ByteArray) and **returned** directly via
122+ // `.convert_output()` (no callback). Also doubles as the nested record
123+ // for the ZSample deconstructor's payload.
124+ . converter ( pq ! ( ZZBytes ) , pq ! ( z_zbytes_to_bytes) )
126125 . ptr_class ( pq ! ( ZEncoding ) )
127126 . package_fun ( pq ! ( z_encoding_id) )
128127 . package_fun ( pq ! ( z_encoding_schema) )
129128 . package_fun ( pq ! ( z_encoding_to_string) )
130129 . package_fun ( pq ! ( z_encoding_clone) )
131130 . package_fun ( pq ! ( z_encoding_from_string) )
132- // Combined ACCESSOR for ZEncoding (output expansion): decompose to its
133- // canonical string (`z_encoding_to_string`), nested by the ZSample
134- // combined accessor below to build the SDK `Encoding(string)`.
135- . accessor ( pq ! ( ZEncoding ) )
136- . accessor_record ( pq ! ( z_encoding_to_string) )
131+ // CONVERTER for ZEncoding: decompose to its canonical string
132+ // (`z_encoding_to_string`), nested by the ZSample deconstructor below to
133+ // build the SDK `Encoding(string)`.
134+ . converter ( pq ! ( ZEncoding ) , pq ! ( z_encoding_to_string) )
137135 // Constructor for ZEncoding: encoding params accept a `String`
138136 // (built via z_encoding_from_string) directly — the SDK passes its
139137 // canonical `repr` String, no per-call `zEncodingFromString` + close.
@@ -197,76 +195,74 @@ fn main() {
197195 . ptr_class ( pq ! ( ZTimestamp ) )
198196 . package_fun ( pq ! ( z_timestamp_ntp64) )
199197 . package_fun ( pq ! ( z_timestamp_id) )
200- // Combined ACCESSOR for ZTimestamp (output expansion): an
201- // `Option<&ZTimestamp>` return (z_sample_timestamp) is decomposed into
202- // its NTP64 value (`z_timestamp_ntp64` → i64 → boxed Long) and delivered
203- // to a builder lambda — no second `zTimestampNtp64` crossing, no
204- // transient handle. No identity record (zenoh-java's TimeStamp keeps the
205- // Long, not the native handle).
206- . accessor ( pq ! ( ZTimestamp ) )
207- . accessor_record ( pq ! ( z_timestamp_ntp64) )
198+ // CONVERTER for ZTimestamp (single-value): an `Option<&ZTimestamp>`
199+ // return (z_sample_timestamp) is converted to its NTP64 value
200+ // (`z_timestamp_ntp64` → i64) and **returned** as `Long?` via
201+ // `.convert_output()` — no callback, fewer JNI crossings than a builder.
202+ // Also the nested record for ZSample's timestamp.
203+ . converter ( pq ! ( ZTimestamp ) , pq ! ( z_timestamp_ntp64) )
208204 . package ( "sample" )
209205 . enum_class ( pq ! ( SampleKind ) )
210206 . ptr_class ( pq ! ( ZSample ) )
211207 . package_fun ( pq ! ( z_sample_key_expr) )
212- . expand_output ( ) // &ZKeyExpr → builder (ZKeyExpr handle, String)
208+ . deconstruct_output ( ) // &ZKeyExpr → builder (ZKeyExpr handle, String)
213209 . package_fun ( pq ! ( z_sample_payload) )
214210 . package_fun ( pq ! ( z_sample_encoding) )
215211 . package_fun ( pq ! ( z_sample_kind) )
216212 . package_fun ( pq ! ( z_sample_timestamp) )
217- . expand_output ( ) // Option<&ZTimestamp> → builder ( Long ntp64) → R?
213+ . convert_output ( ) // Option<&ZTimestamp> → returns Long? (no callback)
218214 . package_fun ( pq ! ( z_sample_express) )
219215 . package_fun ( pq ! ( z_sample_priority) )
220216 . package_fun ( pq ! ( z_sample_congestion_control) )
221217 . package_fun ( pq ! ( z_sample_attachment) )
222- . expand_output ( ) // Option<&ZZBytes> → builder ( ByteArray) → R?
218+ . convert_output ( ) // Option<&ZZBytes> → returns ByteArray? (no callback)
223219 // Combined ACCESSOR for ZSample (output expansion, M3): the full sample
224220 // decomposed in ONE crossing — NESTS the ZKeyExpr (handle+string),
225221 // ZZBytes (payload bytes), ZEncoding (string) and ZTimestamp (ntp64,
226222 // nullable) combined accessors, plus enum leaves (kind/priority/
227223 // congestion → Int) and `express` (bool). Record order = builder arg
228224 // order. Used by `z_reply_sample` below to build a full SDK `Sample`.
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?
225+ . deconstructor ( pq ! ( ZSample ) )
226+ . deconstructor_record_nested ( pq ! ( z_sample_key_expr) ) // → (ZKeyExpr, String)
227+ . deconstructor_record_nested ( pq ! ( z_sample_payload) ) // → ByteArray
228+ . deconstructor_record_nested ( pq ! ( z_sample_encoding) ) // → String
229+ . deconstructor_record ( pq ! ( z_sample_kind) ) // enum → Int
230+ . deconstructor_record_nested ( pq ! ( z_sample_timestamp) ) // Option → Long?
231+ . deconstructor_record ( pq ! ( z_sample_express) ) // bool → Boolean
232+ . deconstructor_record ( pq ! ( z_sample_priority) ) // enum → Int
233+ . deconstructor_record ( pq ! ( z_sample_congestion_control) ) // enum → Int
234+ . deconstructor_record_nested ( pq ! ( z_sample_attachment) ) // Option → ByteArray?
239235 . package ( "pubsub" )
240236 . ptr_class ( pq ! ( ZPublisher ) )
241237 . package_fun ( pq ! ( z_publisher_put) )
242- . expand ( pq ! ( payload) ) // ZZBytes ← ByteArray
243- . expand ( pq ! ( encoding) ) // Option<&ZEncoding> ← String?
244- . expand ( pq ! ( attachment) ) // Option<ZZBytes> ← ByteArray?
238+ . construct ( pq ! ( payload) ) // ZZBytes ← ByteArray
239+ . construct ( pq ! ( encoding) ) // Option<&ZEncoding> ← String?
240+ . construct ( pq ! ( attachment) ) // Option<ZZBytes> ← ByteArray?
245241 . package_fun ( pq ! ( z_publisher_delete) )
246- . expand ( pq ! ( attachment) )
242+ . construct ( pq ! ( attachment) )
247243 . ptr_class ( pq ! ( ZSubscriber ) )
248244 . package ( "query" )
249245 . ptr_class ( pq ! ( ZQueryable ) )
250246 . ptr_class ( pq ! ( ZQuerier ) )
251247 . package_fun ( pq ! ( z_querier_get) )
252- . expand ( pq ! ( payload) ) // Option<ZZBytes> ← ByteArray?
253- . expand ( pq ! ( encoding) ) // Option<&ZEncoding> ← String?
254- . expand ( pq ! ( attachment) ) // Option<ZZBytes> ← ByteArray?
248+ . construct ( pq ! ( payload) ) // Option<ZZBytes> ← ByteArray?
249+ . construct ( pq ! ( encoding) ) // Option<&ZEncoding> ← String?
250+ . construct ( pq ! ( attachment) ) // Option<ZZBytes> ← ByteArray?
255251 . enum_class ( pq ! ( ReplyKeyExpr ) )
256252 . enum_class ( pq ! ( QueryTarget ) )
257253 . enum_class ( pq ! ( ConsolidationMode ) )
258254 . ptr_class ( pq ! ( ZQuery ) )
259255 . package_fun ( pq ! ( z_query_reply_success) )
260- . expand ( pq ! ( key_expr) ) // &ZKeyExpr ← String | handle
261- . expand ( pq ! ( payload) ) // ZZBytes ← ByteArray
262- . expand ( pq ! ( encoding) ) // Option<&ZEncoding> ← String?
263- . expand ( pq ! ( attachment) ) // Option<ZZBytes> ← ByteArray?
256+ . construct ( pq ! ( key_expr) ) // &ZKeyExpr ← String | handle
257+ . construct ( pq ! ( payload) ) // ZZBytes ← ByteArray
258+ . construct ( pq ! ( encoding) ) // Option<&ZEncoding> ← String?
259+ . construct ( pq ! ( attachment) ) // Option<ZZBytes> ← ByteArray?
264260 . package_fun ( pq ! ( z_query_reply_error) )
265- . expand ( pq ! ( payload) ) // ZZBytes ← ByteArray
266- . expand ( pq ! ( encoding) ) // Option<&ZEncoding> ← String?
261+ . construct ( pq ! ( payload) ) // ZZBytes ← ByteArray
262+ . construct ( pq ! ( encoding) ) // Option<&ZEncoding> ← String?
267263 . package_fun ( pq ! ( z_query_reply_delete) )
268- . expand ( pq ! ( key_expr) ) // &ZKeyExpr ← String | handle
269- . expand ( pq ! ( attachment) ) // Option<ZZBytes> ← ByteArray?
264+ . construct ( pq ! ( key_expr) ) // &ZKeyExpr ← String | handle
265+ . construct ( pq ! ( attachment) ) // Option<ZZBytes> ← ByteArray?
270266 . package_fun ( pq ! ( z_query_keyexpr) )
271267 . package_fun ( pq ! ( z_query_parameters) )
272268 . package_fun ( pq ! ( z_query_payload) )
@@ -278,7 +274,7 @@ fn main() {
278274 . package_fun ( pq ! ( z_reply_replier_eid) )
279275 . package_fun ( pq ! ( z_reply_is_ok) )
280276 . package_fun ( pq ! ( z_reply_sample) )
281- . expand_output ( ) // Option<&ZSample> → builder(full Sample leaves) → R?
277+ . deconstruct_output ( ) // Option<&ZSample> → builder(full Sample leaves) → R?
282278 . package_fun ( pq ! ( z_reply_error_payload) )
283279 . package_fun ( pq ! ( z_reply_error_encoding) )
284280 . package ( "liveliness" )
@@ -287,45 +283,45 @@ fn main() {
287283 . ptr_class ( pq ! ( ZSession ) )
288284 . package_fun ( pq ! ( z_open) )
289285 . package_fun ( pq ! ( z_session_declare_publisher) )
290- . expand ( pq ! ( key_expr) ) // ZKeyExpr (by-value) ← String | handle
286+ . construct ( pq ! ( key_expr) ) // ZKeyExpr (by-value) ← String | handle
291287 . package_fun ( pq ! ( z_session_put) )
292- . expand ( pq ! ( key_expr) ) // &ZKeyExpr ← String | handle
293- . expand ( pq ! ( payload) ) // ZZBytes ← ByteArray
294- . expand ( pq ! ( encoding) ) // Option<&ZEncoding> ← String?
295- . expand ( pq ! ( attachment) ) // Option<ZZBytes> ← ByteArray?
288+ . construct ( pq ! ( key_expr) ) // &ZKeyExpr ← String | handle
289+ . construct ( pq ! ( payload) ) // ZZBytes ← ByteArray
290+ . construct ( pq ! ( encoding) ) // Option<&ZEncoding> ← String?
291+ . construct ( pq ! ( attachment) ) // Option<ZZBytes> ← ByteArray?
296292 . package_fun ( pq ! ( z_session_delete) )
297- . expand ( pq ! ( key_expr) ) // &ZKeyExpr ← String | handle
298- . expand ( pq ! ( attachment) ) // Option<ZZBytes> ← ByteArray?
293+ . construct ( pq ! ( key_expr) ) // &ZKeyExpr ← String | handle
294+ . construct ( pq ! ( attachment) ) // Option<ZZBytes> ← ByteArray?
299295 . package_fun ( pq ! ( z_session_declare_subscriber) )
300- . expand ( pq ! ( key_expr) ) // ZKeyExpr (by-value) ← String | handle
296+ . construct ( pq ! ( key_expr) ) // ZKeyExpr (by-value) ← String | handle
301297 . package_fun ( pq ! ( z_session_declare_querier) )
302- . expand ( pq ! ( key_expr) )
298+ . construct ( pq ! ( key_expr) )
303299 . package_fun ( pq ! ( z_session_declare_queryable) )
304- . expand ( pq ! ( key_expr) )
300+ . construct ( pq ! ( key_expr) )
305301 . package_fun ( pq ! ( z_session_declare_keyexpr) )
306302 // z_session_undeclare_keyexpr: NOT expanded — undeclaring requires a
307303 // declared handle, not a string. Stays handle-only.
308304 . package_fun ( pq ! ( z_session_undeclare_keyexpr) )
309305 . package_fun ( pq ! ( z_session_get) )
310- . expand ( pq ! ( key_expr) ) // &ZKeyExpr ← String | handle
311- . expand ( pq ! ( payload) ) // Option<ZZBytes> ← ByteArray?
312- . expand ( pq ! ( encoding) ) // Option<&ZEncoding> ← String?
313- . expand ( pq ! ( attachment) ) // Option<ZZBytes> ← ByteArray?
306+ . construct ( pq ! ( key_expr) ) // &ZKeyExpr ← String | handle
307+ . construct ( pq ! ( payload) ) // Option<ZZBytes> ← ByteArray?
308+ . construct ( pq ! ( encoding) ) // Option<&ZEncoding> ← String?
309+ . construct ( pq ! ( attachment) ) // Option<ZZBytes> ← ByteArray?
314310 . package_fun ( pq ! ( z_session_zid) )
315311 // Output expansion (M4, Iterable): Vec<ZZenohId> → fold, each ZZenohId
316312 // delivered WHOLE (its value_blob projection); caller owns the result
317313 // collection. No combined accessor — the element crosses as the typed
318314 // `ZZenohId` value class, matching the prior `List<ZZenohId>`.
319315 . package_fun ( pq ! ( z_session_peers_zid) )
320- . expand_output ( ) // Vec<ZZenohId> → fun <A>(acc, fold: (A, ZZenohId) -> A): A
316+ . deconstruct_output ( ) // Vec<ZZenohId> → fun <A>(acc, fold: (A, ZZenohId) -> A): A
321317 . package_fun ( pq ! ( z_session_routers_zid) )
322- . expand_output ( )
318+ . deconstruct_output ( )
323319 . package_fun ( pq ! ( z_liveliness_declare_token) )
324- . expand ( pq ! ( key_expr) ) // ZKeyExpr (by-value) ← String | handle
320+ . construct ( pq ! ( key_expr) ) // ZKeyExpr (by-value) ← String | handle
325321 . package_fun ( pq ! ( z_liveliness_get) )
326- . expand ( pq ! ( key_expr) ) // &ZKeyExpr ← String | handle
322+ . construct ( pq ! ( key_expr) ) // &ZKeyExpr ← String | handle
327323 . package_fun ( pq ! ( z_liveliness_declare_subscriber) )
328- . expand ( pq ! ( key_expr) ) ; // ZKeyExpr (by-value) ← String | handle
324+ . construct ( pq ! ( key_expr) ) ; // ZKeyExpr (by-value) ← String | handle
329325
330326 let source = prebindgen:: Source :: new ( zenoh_flat:: PREBINDGEN_OUT_DIR ) ;
331327 let mut registry = match Registry :: from_items ( source. items_all ( ) ) {
0 commit comments