Fix missing trait implementations for value encode.
With these changes, I no longer get the error:
trait
EncodeCounterValueis not implemented foru32
when compiling to mips.
I have also added additional trait implementations for the other types. The reason to cast from 32 to 64 bit values is that in the end, it is casted to 64 bit values anyway, because these are the types that must be used: https://github.com/prometheus/client_rust/blob/master/src/encoding/proto/openmetrics_data_model.proto. This way, there is no need to implement encoder.encode_u32 ... methods.
I believe this is not catched by the tests, because the library itself compiles fine to mips, until you start implementing it. Unfortunately the cross-compile check does not run the tests. I did a quick test changing the cargo check ... to cargo check --target=${{ matrix.target }} --tests, but this will return errors because the dev-dependency pyo3 a bit more than just the Rust toolchain for mips is required.
Fixes #172.
As a reference, this is the error I get when using cargo check ... --tests:
error: failed to run custom build command for `pyo3-ffi v0.20.0`
Caused by:
process didn't exit successfully: `/home/runner/work/client_rust/client_rust/target/debug/build/pyo3-ffi-4fe3cdc12a0f9dda/build-script-build` (exit status: 1)
--- stdout
cargo:rerun-if-env-changed=PYO3_CROSS
cargo:rerun-if-env-changed=PYO3_CROSS_LIB_DIR
cargo:rerun-if-env-changed=PYO3_CROSS_PYTHON_VERSION
cargo:rerun-if-env-changed=PYO3_CROSS_PYTHON_IMPLEMENTATION
cargo:rerun-if-env-changed=PYO3_NO_PYTHON
--- stderr
error: PYO3_CROSS_PYTHON_VERSION or an abi3-py3* feature must be specified when cross-compiling and PYO3_CROSS_LIB_DIR is not set.
warning: build failed, waiting for other jobs to finish...
error: failed to run custom build command for `zstd-sys v2.0.9+zstd.1.5.5`
I would appreciate any additions to the CI to prevent this from happening in the future.
I do not have the bandwidth to work on this short-term, but most likely you would like to use something like: https://github.com/cross-rs/cross
@mxinden I'm looking forward to your feedback on this :-)
Hi @mxinden I'm still looking forward to your feedback :-)