pub struct RObject {
pub tt: RType,
pub value: RValue,
pub object_id: Cell<u64>,
pub singleton_class: RefCell<Option<Rc<RClass>>>,
pub ivar: RefCell<RHashMap<String, Rc<RObject>>>,
}Expand description
Heap-allocated Ruby object wrapper containing type tag, value, and object id.
Fields§
§tt: RType§value: RValue§object_id: Cell<u64>§singleton_class: RefCell<Option<Rc<RClass>>>§ivar: RefCell<RHashMap<String, Rc<RObject>>>Implementations§
Source§impl RObject
impl RObject
pub fn nil() -> Self
pub fn boolean(b: bool) -> Self
pub fn symbol(sym: RSym) -> Self
pub fn integer(n: i64) -> Self
pub fn float(f: f64) -> Self
pub fn string(s: String) -> Self
pub fn string_from_vec(v: Vec<u8>) -> Self
pub fn array(v: Vec<Rc<RObject>>) -> Self
pub fn hash(h: RHash) -> Self
pub fn range(start: Rc<RObject>, end: Rc<RObject>, exclusive: bool) -> Self
pub fn class(c: Rc<RClass>, vm: &mut VM) -> Rc<Self>
pub fn class_singleton(c: Rc<RClass>, vm: &mut VM) -> Rc<RClass>
pub fn module(m: Rc<RModule>) -> Self
pub fn class_or_module(c: Rc<RModule>, vm: &mut VM) -> Rc<Self>
pub fn instance(c: Rc<RClass>) -> Self
pub fn proc(p: RProc) -> Self
pub fn exception(e: Rc<RException>) -> Self
pub fn to_refcount_assigned(self) -> Rc<Self>
pub fn is_falsy(&self) -> bool
pub fn is_truthy(&self) -> bool
pub fn is_nil(&self) -> bool
pub fn is_main(&self) -> bool
pub fn set_ivar(&self, key: &str, value: Rc<RObject>)
pub fn get_ivar(&self, key: &str) -> Rc<RObject>
pub fn as_hash_key(&self) -> Result<ValueHasher, Error>
pub fn as_eq_value(&self) -> ValueEquality
pub fn get_class(&self, vm: &VM) -> Rc<RClass>
pub fn singleton_or_this_class(self: &Rc<Self>, vm: &mut VM) -> Rc<RClass>
pub fn intern(&self) -> Result<RSym, Error>
pub fn as_vec_owned(&self) -> Result<Vec<Rc<RObject>>, Error>
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for RObject
impl !RefUnwindSafe for RObject
impl !Send for RObject
impl !Sync for RObject
impl Unpin for RObject
impl !UnwindSafe for RObject
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more