Files
hyper/capi
Kevin Burke ed2fdb7b6a chore(ffi): fix compile errors and warnings (#2492)
As I understand it, "cargo rustc" in gen_header.sh generates a ton of
errors, but still manages to generate an object that can be used by
cbindgen to generate hyper.h.

However, I tried to make a separate change to add more fields to
hyper.h, and learned that "cargo rustc" stops if it reaches 50 errors,
which I reached. I was able to buy some headroom and fix a number of
the compilation errors by adding imports to the fake Cargo.toml we
generate in gen_header.sh.

I wasn't sure how to resolve imports like "crate::Result" which appear
to reference the top-level src/error.rs, and print an error when they
are compiled in gen_header.sh. But I only need to buy headroom under
the 50 error count for now, which I was able to do by adding the
imports.

It is possible that someone more familiar with Rust than me could look
at this and know what to change to get the total number of errors to
zero.
2021-04-07 16:12:02 -07:00
..
2021-01-08 10:25:53 -08:00

C API for hyper

This provides auxiliary pieces for a C API to use the hyper library.

Unstable

The C API of hyper is currently unstable, which means it's not part of the semver contract as the rest of the Rust API is.

Because of that, it's only accessible if --cfg hyper_unstable_ffi is passed to rustc when compiling. The easiest way to do that is setting the RUSTFLAGS environment variable.

Building

The C API is part of the Rust library, but isn't compiled by default. Using cargo, it can be compiled with the following command:

RUSTFLAGS="--cfg hyper_unstable_ffi" cargo build --features client,http1,http2,ffi