artichoke_backend/
top_self.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
use crate::core::TopSelf;
use crate::sys;
use crate::value::Value;
use crate::Artichoke;

impl TopSelf for Artichoke {
    type Value = Value;

    fn top_self(&mut self) -> Value {
        let top_self = unsafe { self.with_ffi_boundary(|mrb| sys::mrb_top_self(mrb)) };
        top_self.map(Value::from).unwrap_or_default()
    }
}