Rename declare_types! to ruby!

This commit is contained in:
Yehuda Katz 2017-04-21 17:54:52 -07:00
parent b72c306cd4
commit d668a31150
9 changed files with 10 additions and 10 deletions

View File

@ -16,7 +16,7 @@ What follows is an aspirational README :wink:
Helix allows you to write Ruby classes in Rust without having to write the glue code yourself.
```rust
declare_types! {
ruby! {
class Console {
def log(self, string: &str) {
println!("LOG: {}", string);
@ -41,7 +41,7 @@ When you define a method in Helix using `def`, you can specify any Rust type in
Under the hood, Helix will automatically coerce the Ruby type to the specified Rust type, doing appropriate type checks before passing the values into Rust.
```rust
declare_types! {
ruby! {
class Console {
def log(string: &str) {
println!("LOG: {}", string);

View File

@ -1,7 +1,7 @@
#[macro_use]
extern crate helix_runtime;
declare_types! {
ruby! {
class Calculator {
def add(lhs: f64, rhs: f64) -> f64 {
Adder::new(lhs).call(rhs)

View File

@ -3,7 +3,7 @@
#[macro_use]
extern crate helix_runtime;
declare_types! {
ruby! {
class Console {
def log(&self, string: String) {
println!("{}", string);

View File

@ -13,7 +13,7 @@ const SECONDS_PER_WEEK: i64 = 604800;
const SECONDS_PER_MONTH: i64 = 2629746; // 1/12 of a gregorian year
const SECONDS_PER_YEAR: i64 = 31556952; // length of a gregorian year (365.2425 days)
declare_types! {
ruby! {
class Duration {
struct {
seconds: Option<i32>,

View File

@ -1,7 +1,7 @@
#[macro_use]
extern crate helix_runtime as helix;
declare_types! {
ruby! {
reopen class Array {
def is_superset_of(&self, needle: &[usize]) -> bool {
if needle.is_empty() { return true }

View File

@ -1,7 +1,7 @@
#[macro_use]
extern crate helix_runtime;
declare_types! {
ruby! {
class TextTransform {
def widen(text: String) -> String {
text.chars().map(|char| {

View File

@ -1,7 +1,7 @@
#[macro_use]
extern crate helix_runtime as helix;
declare_types! {
ruby! {
reopen class RubyString {
#[ruby_name = "blank?"]
def is_blank(&self) -> bool {

View File

@ -1,7 +1,7 @@
#[macro_use]
extern crate helix_runtime as helix;
// declare_types! {
// ruby! {
// class MyClass {
// def hello(&self) {
// println!("Hello!");

View File

@ -14,7 +14,7 @@ mod coercions;
mod alloc;
#[macro_export]
macro_rules! declare_types {
macro_rules! ruby {
{ $($rest:tt)* } => {
parse! {
state: top_level,