pub struct Runtime { /* private fields */ }Expand description
A loaded-map cache bound to a load path. Interscript.transliterate
parity: transliterate(map_id, string) runs stage main.
Implementations§
Source§impl Runtime
impl Runtime
Sourcepub fn new(load_path: Vec<PathBuf>) -> Runtime
pub fn new(load_path: Vec<PathBuf>) -> Runtime
Examples found in repository?
examples/dbg-run.rs (lines 5-8)
4fn main() {
5 let rt = Runtime::new(vec![
6 "../maps/maps".into(),
7 "../maps/libs".into(),
8 ]);
9 let doc = rt.load("alalc-ben-Beng-Latn-2017").unwrap();
10 println!("deps declared: {:?}", doc.dep_aliases.keys().collect::<Vec<_>>());
11 for (name, stage) in &doc.stages {
12 for item in &stage.items {
13 if let StageItem::Run { dep, stage, .. } = item {
14 println!("stage {name}: run dep={dep:?} stage={stage:?}");
15 }
16 }
17 }
18 let un = rt.load("un-ben-Beng-Latn-2016").unwrap();
19 let out = interscript_rs::interpreter::execute_stage_pub(&un, "main", "ত্য", None);
20 println!("un-ben direct: {:?}", out);
21}Sourcepub fn load(&self, map_id: &str) -> Result<Rc<Document>>
pub fn load(&self, map_id: &str) -> Result<Rc<Document>>
Load (and dependency-close) a map document.
Examples found in repository?
examples/dbg-run.rs (line 9)
4fn main() {
5 let rt = Runtime::new(vec![
6 "../maps/maps".into(),
7 "../maps/libs".into(),
8 ]);
9 let doc = rt.load("alalc-ben-Beng-Latn-2017").unwrap();
10 println!("deps declared: {:?}", doc.dep_aliases.keys().collect::<Vec<_>>());
11 for (name, stage) in &doc.stages {
12 for item in &stage.items {
13 if let StageItem::Run { dep, stage, .. } = item {
14 println!("stage {name}: run dep={dep:?} stage={stage:?}");
15 }
16 }
17 }
18 let un = rt.load("un-ben-Beng-Latn-2016").unwrap();
19 let out = interscript_rs::interpreter::execute_stage_pub(&un, "main", "ত্য", None);
20 println!("un-ben direct: {:?}", out);
21}Sourcepub fn transliterate(&self, map_id: &str, input: &str) -> Result<String>
pub fn transliterate(&self, map_id: &str, input: &str) -> Result<String>
Interscript.transliterate(map_id, string).
Sourcepub fn transliterate_lang(
&self,
map_id: &str,
input: &str,
language: Option<&str>,
) -> Result<String>
pub fn transliterate_lang( &self, map_id: &str, input: &str, language: Option<&str>, ) -> Result<String>
ISC-WF-1 W3: transliterate with a language selection (§5.1).
Selecting a language the map does not declare behaves like no
selection (every when guard inert).
pub fn transliterate_stage( &self, map_id: &str, stage: &str, input: &str, language: Option<&str>, ) -> Result<String>
Auto Trait Implementations§
impl !Freeze for Runtime
impl !RefUnwindSafe for Runtime
impl !Send for Runtime
impl !Sync for Runtime
impl Forget for Runtime
impl Move for Runtime
impl Unpin for Runtime
impl UnsafeUnpin for Runtime
impl UnwindSafe for Runtime
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