Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rustler/otp_headers/codegen/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "nif_api_codegen"
name = "nif-api-codegen"
version = "0.1.0"
edition = "2024"
publish = false
Expand Down
3 changes: 1 addition & 2 deletions rustler/src/sys/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,7 @@ pub enum ErlNifMapIteratorEntry {
pub type ErlNifTime = i64;

/// Error return value for `enif_monotonic_time()`, `enif_time_offset()`, and `enif_convert_time_unit()`.
pub const ERL_NIF_TIME_ERROR: i64 = -9_223_372_036_854_775_808;
//const ERL_NIF_TIME_ERROR:i64 = i64::min_value(); "error: const fn's not yet stable"
pub const ERL_NIF_TIME_ERROR: i64 = i64::MIN;

/// See [ErlNifTimeUnit](http://www.erlang.org/doc/man/erl_nif.html#ErlNifTimeUnit) in the Erlang docs.
#[derive(Copy, Clone)]
Expand Down
1 change: 0 additions & 1 deletion rustler_codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ syn = { version = "3.0", features = ["full", "extra-traits"] }
quote = "1.0"
heck = "0.5"
proc-macro2 = "1.0"
inventory = "0.3"

[dev-dependencies]
trybuild = "1.0"
2 changes: 1 addition & 1 deletion rustler_tests/native/binary_example/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ authors = []
edition = "2021"

[[bin]]
name = "binary_example"
name = "binary-example"
path = "src/main.rs"
50 changes: 25 additions & 25 deletions rustler_tests/native/rustler_serde_test/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,33 +32,33 @@ pub fn test<'a>(
"false" => run_test!(false),

// Signed Integers
"i8 (min)" => run_test!(i8::min_value()),
"i8 (min)" => run_test!(i8::MIN),
"i8 (0)" => run_test!(0_i8),
"i8 (max)" => run_test!(i8::max_value()),
"i16 (min)" => run_test!(i16::min_value()),
"i8 (max)" => run_test!(i8::MAX),
"i16 (min)" => run_test!(i16::MIN),
"i16 (0)" => run_test!(0_i16),
"i16 (max)" => run_test!(i16::max_value()),
"i32 (min)" => run_test!(i32::min_value()),
"i16 (max)" => run_test!(i16::MAX),
"i32 (min)" => run_test!(i32::MIN),
"i32 (0)" => run_test!(0_i32),
"i32 (max)" => run_test!(i32::max_value()),
"i64 (min)" => run_test!(i64::min_value()),
"i32 (max)" => run_test!(i32::MAX),
"i64 (min)" => run_test!(i64::MIN),
"i64 (0)" => run_test!(0_i64),
"i64 (max)" => run_test!(i64::max_value()),
"i128 (min)" => run_test!(i128::min_value()),
"i64 (max)" => run_test!(i64::MAX),
"i128 (min)" => run_test!(i128::MIN),
"i128 (0)" => run_test!(0_i128),
"i128 (max)" => run_test!(i128::max_value()),
"i128 (max)" => run_test!(i128::MAX),

// Unsigned Integers
"u8 (min)" => run_test!(u8::min_value()),
"u8 (max)" => run_test!(u8::max_value()),
"u16 (min)" => run_test!(u16::min_value()),
"u16 (max)" => run_test!(u16::max_value()),
"u32 (min)" => run_test!(u32::min_value()),
"u32 (max)" => run_test!(u32::max_value()),
"u64 (min)" => run_test!(u64::min_value()),
"u64 (max)" => run_test!(u64::max_value()),
"u128 (min)" => run_test!(u128::min_value()),
"u128 (max)" => run_test!(u128::max_value()),
"u8 (min)" => run_test!(u8::MIN),
"u8 (max)" => run_test!(u8::MAX),
"u16 (min)" => run_test!(u16::MIN),
"u16 (max)" => run_test!(u16::MAX),
"u32 (min)" => run_test!(u32::MIN),
"u32 (max)" => run_test!(u32::MAX),
"u64 (min)" => run_test!(u64::MIN),
"u64 (max)" => run_test!(u64::MAX),
"u128 (min)" => run_test!(u128::MIN),
"u128 (max)" => run_test!(u128::MAX),

// Float32
"f32 (0)" => run_test!(f32::from_bits(0x0000_0000)),
Expand Down Expand Up @@ -99,10 +99,10 @@ pub fn test<'a>(
"unit variant" => run_test!(UnitVariant::A),

// Newtype Types
"newtype struct" => run_test!(NewtypeStruct(u8::max_value())),
"newtype variant" => run_test!(NewtypeVariant::N(u8::max_value())),
"newtype struct" => run_test!(NewtypeStruct(u8::MAX)),
"newtype variant" => run_test!(NewtypeVariant::N(u8::MAX)),
"newtype variant (ok tuple)" => {
let ok: Result<u8, String> = Ok(u8::max_value());
let ok: Result<u8, String> = Ok(u8::MAX);
run_test!(ok)
}
"newtype variant (error tuple)" => {
Expand All @@ -115,8 +115,8 @@ pub fn test<'a>(
"sequences (primitive)" => run_test!(vec!["hello", "world"]),
"sequences (byte)" => run_test!(vec![2, 3, 5, 7, 11, 13]),
"sequences (complex)" => {
let a = NewtypeStruct(u8::min_value());
let b = NewtypeStruct(u8::max_value());
let a = NewtypeStruct(u8::MIN);
let b = NewtypeStruct(u8::MAX);
run_test!(vec![a, b])
}

Expand Down
2 changes: 1 addition & 1 deletion rustler_tests/native/rustler_test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ path = "src/lib.rs"
crate-type = ["cdylib"]

[[bin]]
name = "hello_rust"
name = "hello-rust"
path = "src/main.rs"

[features]
Expand Down
2 changes: 1 addition & 1 deletion rustler_tests/test/binary_example_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ defmodule BinaryExampleTest do
use ExUnit.Case

test "binary is compiled" do
bins = ~w(binary_example hello_rust)
bins = ~w(binary-example hello-rust)

for bin <- bins do
assert_exists(bin)
Expand Down
8 changes: 4 additions & 4 deletions rustler_tests/test/primitives_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ defmodule RustlerTest.PrimitivesTest do
assert i == RustlerTest.echo_i128(i)
assert -i == RustlerTest.echo_i128(-i)

# i128::min_value()
# i128::MIN
i = -170_141_183_460_469_231_731_687_303_715_884_105_728
assert i == RustlerTest.echo_i128(i)

# i128::max_value()
# i128::MAX
i = 170_141_183_460_469_231_731_687_303_715_884_105_727
assert i == RustlerTest.echo_i128(i)

# u128::max_value()
# u128::MAX
i = 0xFFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF
assert_raise ArgumentError, fn -> RustlerTest.echo_i128(:non_int) end
assert_raise ArgumentError, fn -> RustlerTest.echo_i128(123.45) end
Expand All @@ -80,7 +80,7 @@ defmodule RustlerTest.PrimitivesTest do
i = 1 <<< 127
assert i == RustlerTest.echo_u128(i)

# u128::max_value()
# u128::MAX
i = 0xFFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF
assert i == RustlerTest.echo_u128(i)

Expand Down
Loading