pub trait ConsoleFactory: Send {
// Required method
fn build(self: Box<Self>) -> Result<Rc<RefCell<dyn Console>>>;
}Expand description
Trait for an object that is able to instantiate a console.
Console objects are not Send so we must instantiate them within the thread that runs
the REPL. But in some cases, we need to create the console in a thread that’s different than
the one that will run it. The factory allows us to prepare the console elsewhere, passing the
Send-safe factory into the REPL thread.
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".