~tim/rust-ruby-wrap-data

0f69c70a2f8459f2c048aed5f26787e457f9991a — Tim Morgan 2 years ago 99c5600
Rename 'update' to 'set'
2 files changed, 2 insertions(+), 2 deletions(-)

M src/lib.rs
M src/wrap.rs
M src/lib.rs => src/lib.rs +1 -1
@@ 55,6 55,6 @@ fn mutate_that_data(itself: Value) -> Value {
        MyValue::Str("foo".to_string()),
        MyValue::Vec(vec![MyValue::Str("bar".to_string())]),
    ]);
    wrap::update(itself, new_data);
    wrap::set(itself, new_data);
    itself
}

M src/wrap.rs => src/wrap.rs +1 -1
@@ 41,7 41,7 @@ pub fn get<T>(itself: Value) -> Box<T> {
    unsafe { Box::from_raw(datap) }
}

pub fn update<T>(itself: Value, data: Box<T>) {
pub fn set<T>(itself: Value, data: Box<T>) {
    let datap = Box::into_raw(data) as *mut c_void;
    let rdata: *mut RData = unsafe { mem::transmute(itself) };
    unsafe { (*rdata).data = datap };