Expand description
Ready-made BopHost building blocks for embedders.
Most embedders only need two things beyond the default trait
impl: a way to plug in a module resolver, and a way to capture
print output. This module provides both as composable
pieces so you can mix-and-match without re-implementing the
whole trait from scratch.
use bop::host::{StringModuleHost, resolve_from_map};
use bop::BopLimits;
// Map of module-name → source, resolved in-process (no I/O).
let mut host = StringModuleHost::new([
("greetings", "fn hello() { print(\"hi\") }"),
]);
bop::run("use greetings\nhello()", &mut host, &BopLimits::standard())
.unwrap();The helpers intentionally stay minimal — they don’t own the
terminal, they don’t touch the filesystem, they don’t parse
environment variables. Embedders that want richer behaviour
should implement BopHost directly or wrap these helpers.
Structs§
- String
Module Host - A minimal
BopHostthat capturesprintoutput and serves modules from an in-memory string table.
Functions§
- resolve_
from_ map - Build a
BopHost::resolve_moduleimplementation from an in-memory table of(module_path, source)pairs.