Crate rb_sys

Source
Expand description

§rb-sys

Join the discussion

Autogenerated Rust bindings for Ruby. Uses the rust-bindgen crate to generate bindings from the ruby.h header.

§Notice

This is a very low-level library. If you are looking to write a gem in Rust, you should probably use https://github.com/matsadler/magnus crate, with the rb-sys-interop feature.

If you actually need raw/unsafe bindings to libruby, then this crate is for you!

§Documentation

For comprehensive documentation, please refer to the Ruby on Rust Book, which includes:

§License

Licensed under either of

  • Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
  • MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)

at your option.

§Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Re-exports§

pub use stable_api::StableApiDefinition;
pub use bindings::*;
pub use macros::*;
pub use special_consts::*;
pub use value_type::*;

Modules§

bindings
Raw bindings to libruby, generated by bindgen.
macros
Implementation of Ruby macros.
memory
special_consts
Definitions for Ruby’s special constants.
stable_api
Stable ABI functions which provide access to Ruby internals that is compatible across Ruby versions, and are guaranteed to be not break due to Ruby binary changes.
symbol
tracking_allocator
Support for reporting Rust memory usage to the Ruby GC.
value_type
Definitions for Ruby’s special constants.

Macros§

debug_ruby_assert_type
Macro for conditionally asserting type checks in Ruby, only active when RUBY_DEBUG is enabled. This matches Ruby’s behavior of only checking types in debug mode.
rb_gc_guard
Prevents premature destruction of local objects.
rb_intern
Finds or creates a symbol for the given static string. This macro will memoize the ID to avoid repeated calls to libruby. You should prefer this macro over [rb_intern3] when the string is known at compile time.
ruby_abi_versionDeprecated
set_global_tracking_allocator
Set the global allocator to TrackingAllocator.

Type Aliases§

RubyValueDeprecated
ValueDeprecated