Stream: t-libs

Topic: rust-lang/libz-sys#59


JP Sugarbroad (Jan 15 2020 at 20:22, on Zulip):

Any thoughts on this? I know this predates Pin, but it seems like there should be a best practice here.

Steven Fackler (Jan 15 2020 at 20:26, on Zulip):

A -sys crate is just supposed to be a direct translation of a C API.

Steven Fackler (Jan 15 2020 at 20:26, on Zulip):

it does not expose a safe interface. that would be the job of another crate consuming libz-sys

simulacrum (Jan 15 2020 at 21:36, on Zulip):

in particular I believe this is because you can (generally) only have one libz-sys due to links in Cargo.toml, IIRC, so you want it to be as thin a wrapper as possible

JP Sugarbroad (Jan 15 2020 at 23:21, on Zulip):

Yes, but now that we have Pin the crate should probably annotate non-movable types, no?

simulacrum (Jan 15 2020 at 23:27, on Zulip):

I think no, or at least I would not expect it to

simulacrum (Jan 15 2020 at 23:27, on Zulip):

like most sys crates basically have no "Rust" types in them

simulacrum (Jan 15 2020 at 23:27, on Zulip):

(modulo primitives)

Steven Fackler (Jan 16 2020 at 02:32, on Zulip):

Adding an !Unpin to that type isn't going to do much anyway - that only affects behavior when interacting with Pin in the first place.

JP Sugarbroad (Jan 16 2020 at 06:23, on Zulip):

Won't it change it so Pin<Box<z_stream>> works correctly?

JP Sugarbroad (Jan 16 2020 at 06:24, on Zulip):

like most sys crates basically have no "Rust" types in them

What is z_stream then?

Lokathor (Jan 16 2020 at 06:27, on Zulip):

note that whatever it is links really does in cargo.toml is under documented, and particularly you can link to a lib without a links entry.

simulacrum (Jan 16 2020 at 11:58, on Zulip):

Links in cargo just means only one package in your crate graph with that key can exist

Steven Fackler (Jan 16 2020 at 12:05, on Zulip):

z_stream is a direct transcription of the z_stream type in libz's header files.

JP Sugarbroad (Jan 16 2020 at 18:55, on Zulip):

Perhaps I do not understand what you mean by "Rust" types.

simulacrum (Jan 16 2020 at 21:13, on Zulip):

No types that are not C-compatible, basically

simulacrum (Jan 16 2020 at 21:14, on Zulip):

i.e. repr(C)

simulacrum (Jan 16 2020 at 21:14, on Zulip):

and essentially only primitives from std/core

simulacrum (Jan 16 2020 at 21:14, on Zulip):

i.e., not String or CStr

Steven Fackler (Jan 17 2020 at 13:57, on Zulip):

or PhantomPinned

Last update: Feb 25 2020 at 04:15UTC