Usage example:

Create a new rust crate and make sure to specify crate-type to be "dylib". Also add rutie, rutie-serde, serde and possibly serde_derive as a dependency.

```toml [package] edition = "2018"

[lib] crate-type = ["dylib"] name = "rubyrustdemo"

[dependencies] rutie = "0.5.2" rutie-serde = { path = "/Users/andriidmytrenko/dev/rust/rutie-serde" } serde = "1.0" serde_derive = "1.0" ```

The usage is very similar to how you would use rutie on it's own, but instead of calling rutie_methods! macro, you call rutie_serde_methods!. This macro takes care of deserializing arguments and serializing return values. It also captures all panics inside those methods and raises them as an exception in ruby.

```rust use rutie::{Class, Object, class}; use rutieserde::rutieserdemethods; use serdederive::{Serialize, Deserialize};

[derive(Debug, Deserialize)]

pub struct User { pub name: String, pub id: u64, }

class!(HelloWorld); rutieserdemethods!( HelloWorld, itself, rubyclass!(Exception),

fn hello(name: String) -> String {
    format!("Hello {}", name)
}

fn hello_user(user: User) -> String {
    format!("Hello {:?}", user)
}

);

[allow(nonsnakecase)]

[no_mangle]

pub extern "C" fn Initrubyrustdemo() { let mut class = Class::new("RubyRustDemo", None); class.define(|itself| itself.defself("hello", hello) ); class.define(|itself| itself.defself("hellouser", hello_user) ); } ```