pub struct ValBuilder<'a> { /* private fields */ }Expand description
Builds a value for the VM to consume.
- This is often returned by NativeFunction.
ValBuilderobjects may be built from NativeFunctionContext objects.
fn my_magic_string(ctx: spore_vm::val::NativeFunctionContext) -> spore_vm::error::VmResult<spore_vm::val::ValBuilder> {
Ok(ctx.new_string("42".into()))
}Implementations§
Source§impl ValBuilder<'static>
impl ValBuilder<'static>
Sourcepub fn new(val: Val<'static>) -> ValBuilder<'static>
pub fn new(val: Val<'static>) -> ValBuilder<'static>
Create a new ValBuilder from a static Val.
spore_vm::val::ValBuilder::new(().into()); // void
spore_vm::val::ValBuilder::new(true.into()); // bool
spore_vm::val::ValBuilder::new(0i64.into()); // int
spore_vm::val::ValBuilder::new(0.0.into()); // floatTrait Implementations§
Source§impl<'a> Debug for ValBuilder<'a>
impl<'a> Debug for ValBuilder<'a>
Source§impl From<Val<'static>> for ValBuilder<'static>
impl From<Val<'static>> for ValBuilder<'static>
Source§fn from(val: Val<'_>) -> ValBuilder<'_>
fn from(val: Val<'_>) -> ValBuilder<'_>
Converts to this type from the input type.
Auto Trait Implementations§
impl<'a> Freeze for ValBuilder<'a>
impl<'a> RefUnwindSafe for ValBuilder<'a>
impl<'a> Send for ValBuilder<'a>
impl<'a> Sync for ValBuilder<'a>
impl<'a> Unpin for ValBuilder<'a>
impl<'a> UnwindSafe for ValBuilder<'a>
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