Comments (9)
erlang_nif-sys
doesn't expose enif_snprintf
because it takes a variable number of arguments. However, I hacked this into erlang_nif-sys/lib.rs
and it worked:
extern "C" {
pub fn enif_snprintf(str: *mut c_char, size: size_t, format: *const c_char, term: ERL_NIF_TERM) -> c_int;
}
I think enif_snprintf
is new in Erlang/OTP 19, which maybe means we should put it behind a feature flag. Everything else works in Erlang/OTP 18 and up.
from rustler.
See 7ca1e09.
from rustler.
Could this be something we could only make available when using in debug
mode? If you attempt to use in release
mode it would not compile?
from rustler.
No, the debug trait simply describes what happens when you try to debug print something. I don't think there is any reason this should only be available in release mode.
from rustler.
@hansihe I think you misunderstood me? I was saying that the Debug trait impl should only be available if the crate is compiled in debug
(default) mode. If the crate is compiled in release
mode, any debug formatting left in could throw a compile error.
I'm not even sure this is possible or a good idea, just throwing it out there.
But also putting it behind a feature could be a nice way to make it optional.
from rustler.
Seeing as no other debug implementations do this, I don't think we should do it either.
from rustler.
I just found out that Rust does support varargs for extern "C" functions. So this will be pretty easy, it starts with uncommenting a few lines in erlang_nif-sys
.
from rustler.
from rustler.
This was resolved a while ago.
from rustler.
Related Issues (20)
- `nif` macro fails with macro arguments HOT 2
- New Binary from Vec or Slice
- Support for enif_monitor_process HOT 1
- resource with lifetime
- Expose `enif_is_process_alive` HOT 4
- rustler errors on OTP26 HOT 1
- How to conveniently work with binaries as vectors of bytes?
- Why does Term::map_from_pairs return a NifResult?
- Support for fully custom `:load_from` for escripts HOT 8
- This OTP release uses the unsupported Erlang NIF version "2.17" HOT 1
- Test NifStruct derived traits
- Running `dialiyzer` with `rustler` 0.30.0 results in "The pattern can never match the type"" HOT 4
- Import structs from a library
- Can't `mix compile` with path dependency in `Cargo.toml` HOT 2
- Obscure error messages HOT 3
- Would you mind to release `rustler-0.30.1` which includes #570 ? HOT 1
- [Feature request] Add support for i128 and u128 HOT 6
- Unsupported Erlang version error with OTP 26 and features = nif_version_2_17 in Cargo.toml HOT 3
- [Feature request] Support for serializing Path/PathBuf HOT 2
- Transparently decode mixed lists of floats/integers into `f64`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rustler.