Skip to content

Commit

Permalink
fix compile error in bytes feature
Browse files Browse the repository at this point in the history
  • Loading branch information
matsadler committed Sep 18, 2023
1 parent a6f9c4a commit f33d38a
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 12 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@

### Security

## [0.6.2] - 2023-09-18
### Fixed
- Compliation error in `bytes` feature.

## [0.6.1] - 2023-08-20
### Changed
- Support `rb-sys`' `stable-api` feature.
Expand Down Expand Up @@ -402,7 +406,8 @@
- Pre-built bindings for Ruby 2.6 - 3.1 on common platforms, build-time
generated bindings otherwise.

[Unreleased]: https://github.com/matsadler/magnus/compare/0.6.1...0.6
[Unreleased]: https://github.com/matsadler/magnus/compare/0.6.2...0.6
[0.6.2]: https://github.com/matsadler/magnus/compare/0.6.1...0.6.2
[0.6.1]: https://github.com/matsadler/magnus/compare/0.6.0...0.6.1
[0.6.0]: https://github.com/matsadler/magnus/compare/0.5.3...0.6.0
[0.5.3]: https://github.com/matsadler/magnus/compare/0.5.2...0.5.3
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "magnus"
version = "0.6.1"
version = "0.6.2"
edition = "2021"
description = "High level Ruby bindings. Write Ruby extension gems in Rust, or call Ruby code from a Rust binary."
keywords = ["ruby", "rubygem", "extension", "gem"]
Expand Down Expand Up @@ -31,7 +31,7 @@ rb-sys = { version = "0.9.81", default-features = false, features = ["bindgen-rb
seq-macro = "0.3"

[dev-dependencies]
magnus = { path = ".", features = ["embed", "rb-sys"] }
magnus = { path = ".", features = ["embed", "rb-sys", "bytes"] }
rb-sys = { version = "0.9", default-features = false, features = ["stable-api-compiled-fallback"] }

[build-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion examples/complete_object/ext/temperature/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/custom_exception_ruby/ext/ahriman/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/custom_exception_rust/ext/ahriman/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/rust_blank/ext/rust_blank/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/r_string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1744,7 +1744,7 @@ unsafe impl IntoValueFromNative for &str {}
impl IntoValue for bytes::Bytes {
#[inline]
fn into_value_with(self, handle: &Ruby) -> Value {
handle.str_from_slice(self.as_ref()).into()
handle.str_from_slice(self.as_ref()).into_value_with(handle)
}
}

Expand Down
5 changes: 2 additions & 3 deletions tests/bytes.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#[test]
#[cfg(feature = "bytes")]
fn it_converts_to_bytes() {
use magnus::{eval, RString};
use magnus::RString;

let ruby = unsafe { magnus::embed::init() };

let s: RString = unsafe { ruby.eval("[0,0,0].pack('c*')").unwrap() };
let s: RString = ruby.eval("[0,0,0].pack('c*')").unwrap();
assert_eq!(bytes::Bytes::from_static(&[0, 0, 0]), s.to_bytes());
}

0 comments on commit f33d38a

Please sign in to comment.