~tim/rust-ruby-wrap-data

87a1afb406fbc10d5357f434c2e98a4adb5635c1 — Tim Morgan 2 years ago 16f450f
Update code format
2 files changed, 6 insertions(+), 13 deletions(-)

M src/lib.rs
M src/wrap.rs
M src/lib.rs => src/lib.rs +5 -12
@@ 3,8 3,7 @@ extern crate ruby_sys;

mod wrap;

use ruby_sys::{class::{rb_define_class, rb_define_method}, rb_cObject,
               types::{CallbackPtr, Value}};
use ruby_sys::{class::{rb_define_class, rb_define_method}, rb_cObject, types::{CallbackPtr, Value}};

use std::ffi::CString;
use std::mem;


@@ 52,16 51,10 @@ fn show_me_the_data(itself: Value) -> Value {

fn mutate_that_data(itself: Value) -> Value {
    println!("mutating the data");
    let new_data: Box<Vec<MyValue>> = Box::new(
        vec![
            MyValue::Str("foo".to_string()),
            MyValue::Vec(Box::new(
                vec![
                    MyValue::Str("bar".to_string())
                ]
            ))
        ]
    );
    let new_data: Box<Vec<MyValue>> = Box::new(vec![
        MyValue::Str("foo".to_string()),
        MyValue::Vec(Box::new(vec![MyValue::Str("bar".to_string())])),
    ]);
    wrap::update(itself, new_data);
    itself
}

M src/wrap.rs => src/wrap.rs +1 -1
@@ 1,4 1,4 @@
use ruby_sys::{types::{c_void, CallbackPtr, RBasic, Value}};
use ruby_sys::types::{c_void, CallbackPtr, RBasic, Value};

use std::mem;