File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -69,6 +69,14 @@ macro_rules! decode_owned_raw {
6969 } ;
7070}
7171
72+ macro_rules! decode_arc_from_raw {
73+ ( ) => {
74+ InputFn :: new( |input: & syn:: Ident | -> TokenStream {
75+ quote! { ( * std:: sync:: Arc :: from_raw( #input) ) . clone( ) }
76+ } )
77+ } ;
78+ }
79+
7280macro_rules! encode_wrapper {
7381 ( $path: path) => {
7482 OutputFn :: new( |output: Option <& syn:: Ident >| -> TokenStream {
@@ -147,9 +155,7 @@ fn shared_bindings() -> TypeRegistry {
147155 // (releasing its strong reference at end of scope) and hands a cloned
148156 // `Session` to the wrapped fn. Used by `drop_session`.
149157 . type_pair ( "Session" , "*const Session" )
150- . input ( InputFn :: new ( |input : & syn:: Ident | -> TokenStream {
151- quote ! { ( * std:: sync:: Arc :: from_raw( #input) ) . clone( ) }
152- } ) )
158+ . input ( decode_arc_from_raw ! ( ) )
153159 // Returns: ZenohId / Vec<ZenohId> via custom encoders.
154160 . type_pair ( "ZResult<ZenohId>" , "jni::sys::jbyteArray" )
155161 . output ( encode_wrapper ! ( crate :: zenoh_id:: zenoh_id_to_byte_array) )
You can’t perform that action at this time.
0 commit comments