I'm not sure if there's a deliberate design decision behind this, but it feels off that the C API libz-rs-sys offers more functionality than the pure Rust API given that this library is implemented in Rust. Implementing the Clone trait on Deflate and Inflate seems like an idiomatic fit for exposing the same functionality as provided by inflateCopy and deflateCopy in the Rust API.
Extra context
There's currently a spike going on trying to get Rust integrated into CPython. As a first goal Python's zlib module was chosen to be ported from C to Rust. While using the APIs in libz-rs-sys would be an option, it somewhat defeats the purpose by loosing much of the memory- and type-safety benefits Rust gives.
Cf. Rust-for-CPython/zlib-py#4
I'm not sure if there's a deliberate design decision behind this, but it feels off that the C API
libz-rs-sysoffers more functionality than the pure Rust API given that this library is implemented in Rust. Implementing theClonetrait onDeflateandInflateseems like an idiomatic fit for exposing the same functionality as provided byinflateCopyanddeflateCopyin the Rust API.Extra context
There's currently a spike going on trying to get Rust integrated into CPython. As a first goal Python's
zlibmodule was chosen to be ported from C to Rust. While using the APIs inlibz-rs-syswould be an option, it somewhat defeats the purpose by loosing much of the memory- and type-safety benefits Rust gives.Cf. Rust-for-CPython/zlib-py#4