mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
Drop the generated method map
I'd been thinking it might be useful for a future API service, but I think that's better implemented with more codegen, so we have a statically-typed interface.
This commit is contained in:
parent
a31d669a90
commit
c0f73d5f97
3 changed files with 0 additions and 20 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -123,7 +123,6 @@ dependencies = [
|
||||||
"num_enum",
|
"num_enum",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"percent-encoding-iri",
|
"percent-encoding-iri",
|
||||||
"phf 0.11.1",
|
|
||||||
"pin-project",
|
"pin-project",
|
||||||
"prettyplease 0.2.7",
|
"prettyplease 0.2.7",
|
||||||
"prost",
|
"prost",
|
||||||
|
|
|
@ -80,7 +80,6 @@ nom = "7.1.3"
|
||||||
num_cpus = "1.15.0"
|
num_cpus = "1.15.0"
|
||||||
num_enum = "0.6.1"
|
num_enum = "0.6.1"
|
||||||
once_cell = "1.17.1"
|
once_cell = "1.17.1"
|
||||||
phf = "0.11.1"
|
|
||||||
pin-project = "1.0.12"
|
pin-project = "1.0.12"
|
||||||
prost = "0.11.8"
|
prost = "0.11.8"
|
||||||
pulldown-cmark = "0.9.2"
|
pulldown-cmark = "0.9.2"
|
||||||
|
|
|
@ -25,7 +25,6 @@ pub fn write_rust_interface(pool: &DescriptorPool) -> Result<()> {
|
||||||
|
|
||||||
render_top_level_run_method(&mut buf, &services, true);
|
render_top_level_run_method(&mut buf, &services, true);
|
||||||
render_top_level_run_method(&mut buf, &services, false);
|
render_top_level_run_method(&mut buf, &services, false);
|
||||||
render_method_lookup(&mut buf, &services);
|
|
||||||
|
|
||||||
// println!("{}", &buf);
|
// println!("{}", &buf);
|
||||||
let buf = format_code(buf)?;
|
let buf = format_code(buf)?;
|
||||||
|
@ -305,20 +304,3 @@ fn render_individual_service_run_method(buf: &mut String, service: &RustService,
|
||||||
"#,
|
"#,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_method_lookup(buf: &mut String, services: &[RustService]) {
|
|
||||||
writeln!(
|
|
||||||
buf,
|
|
||||||
"
|
|
||||||
pub const METHODS_BY_NAME: phf::Map<&str, (u32, u32)> = phf::phf_map! {{
|
|
||||||
"
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
for (sidx, service) in services.iter().enumerate() {
|
|
||||||
for (midx, method) in service.methods.iter().enumerate() {
|
|
||||||
let name = &method.name;
|
|
||||||
writeln!(buf, r#" "{name}" => ({sidx}, {midx}),"#,).unwrap();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
buf.push_str("};\n");
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue