2023-05-14 18:44:25 +08:00
|
|
|
from . import DR_mod_runtime
|
|
|
|
from Difficult_Rocket.main import Console
|
|
|
|
|
2024-06-09 20:06:08 +08:00
|
|
|
from typing import Optional
|
|
|
|
|
2023-05-14 18:44:25 +08:00
|
|
|
if DR_mod_runtime.use_DR_rust:
|
|
|
|
from .Difficult_Rocket_rs import Console_rs
|
|
|
|
|
|
|
|
|
|
|
|
class RustConsole(Console):
|
2023-12-03 16:54:07 +08:00
|
|
|
name = "Rust stdin Console"
|
2023-05-14 18:44:25 +08:00
|
|
|
|
|
|
|
running: bool = False
|
|
|
|
console: Console_rs
|
|
|
|
|
|
|
|
def start(self):
|
|
|
|
self.console.start()
|
|
|
|
|
|
|
|
def stop(self):
|
|
|
|
return self.console.stop()
|
|
|
|
|
|
|
|
def init(self, **kwargs) -> None:
|
|
|
|
self.console = Console_rs()
|
|
|
|
|
2024-06-09 20:06:08 +08:00
|
|
|
def get_command(self) -> Optional[str]:
|
|
|
|
return self.console.get_command()
|
2023-06-18 15:42:35 +08:00
|
|
|
|
|
|
|
def new_command(self) -> None:
|
|
|
|
self.console.new_command()
|