rune/core/object.rs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
//! The core object defintions.
//!
//! Objects are implemented as rust enum with at max a 56 bit payload. This
//! means that it will always be 64 bits. 32 bit systems are not supported.
//! Because of this it gives us more flexibility in the amount of information we
//! can encode in the object header. For example, we can have 255 variants of
//! objects before we need to box the object header. We are making the
//! assumption that pointers are no bigger then 56 bits and that they are word
//! aligned. All objects should be bound to a lifetime to ensure sound operation
//! of the vm.
mod buffer;
mod cell;
mod convert;
mod float;
mod func;
mod hashtable;
mod string;
mod symbol;
mod tagged;
mod vector;
pub(crate) use buffer::*;
pub(super) use cell::*;
pub(crate) use convert::*;
pub(crate) use float::*;
pub(crate) use func::*;
pub(crate) use hashtable::*;
pub(crate) use string::*;
pub(crate) use symbol::*;
pub(crate) use tagged::*;
pub(crate) use vector::*;
use std::fmt::Write as _;
pub(crate) fn display_slice<T: std::fmt::Display>(slice: &[T]) -> String {
let mut buffer = String::new();
buffer.push('[');
for x in slice {
write!(&mut buffer, "{x} ").expect("failed to display slice");
}
buffer.push(']');
buffer
}