Skip to content

C API bindings for libthreescalers.{so,a}#100

Draft
unleashed wants to merge 12 commits intomasterfrom
capi
Draft

C API bindings for libthreescalers.{so,a}#100
unleashed wants to merge 12 commits intomasterfrom
capi

Conversation

@unleashed
Copy link
Member

This sets up cargo-c to generate a dynamic/static library and a C header file.

Includes infrastructure to expose Rust functions and modules, and so far includes:

  • encoding
  • mapping_rules

This was referenced Jul 26, 2021
…ode` generic

This lifts the need to check the strings coming in from the C boundary
and enables better ergonomics for this function.
We are exposing it in two ways to check on the ergonomics, but should
eventually settle on one.
…_ints

c_int::from(bool) relies on the semantics documented in the Rust
reference so that:

i{32,64,etc}::from(b: bool) will return 0 with b == false and 1 with b
== true.

This change also uses `return {0,1,-1}` without an explicit From::from
for c_int as suggested by clippy. The semantics now require that a
(signed) C integer has a direct representation as a signed Rust one _as
inferred by the compiler_ (ie. i32, i64, ...).
@codecov-commenter
Copy link

codecov-commenter commented Sep 4, 2021

Codecov Report

Merging #100 (1e79cd4) into master (f813a7a) will decrease coverage by 6.46%.
The diff coverage is 1.28%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #100      +/-   ##
==========================================
- Coverage   66.82%   60.35%   -6.47%     
==========================================
  Files          31       36       +5     
  Lines        2146     2376     +230     
==========================================
  Hits         1434     1434              
- Misses        712      942     +230     
Impacted Files Coverage Δ
src/capi/c_slice.rs 0.00% <0.00%> (ø)
src/capi/encoding.rs 0.00% <0.00%> (ø)
src/capi/ffi_cow.rs 0.00% <0.00%> (ø)
src/capi/mapping_rule.rs 0.00% <0.00%> (ø)
src/capi/version.rs 0.00% <0.00%> (ø)
src/lib.rs 100.00% <ø> (ø)
src/encoding.rs 100.00% <100.00%> (ø)
src/extensions/extension.rs 100.00% <100.00%> (ø)
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f813a7a...1e79cd4. Read the comment docs.

@unleashed unleashed force-pushed the capi branch 4 times, most recently from 98e219e to b3afde5 Compare September 4, 2021 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants