Extract Rust2Js like Js2Rust was extracted

Along the way clean up a lot of the formatting of the auto-generated code to
make it a bit prettier by default.
This commit is contained in:
Alex Crichton
2018-04-16 13:31:56 -07:00
parent 49ead6a0d0
commit efb64b87d4
3 changed files with 437 additions and 304 deletions

View File

@ -1,4 +1,4 @@
use super::Context;
use super::{indent, Context};
use descriptor::{Descriptor, Function};
/// Helper struct for manfuacturing a shim in JS used to translate JS types to
@ -305,13 +305,3 @@ impl<'a, 'b> Js2Rust<'a, 'b> {
ret
}
}
fn indent(s: &str) -> String {
let mut ret = String::new();
for line in s.lines() {
ret.push_str(" ");
ret.push_str(line);
ret.push_str("\n");
}
return ret
}