MCPcopy Create free account
hub / github.com/LPC4/Full-Stack / source_const_name

Function source_const_name

build.rs:304–323  ·  view source on GitHub ↗
(name: &str)

Source from the content-addressed store, hash-verified

302 for program in programs {
303 let source_const = source_const_name(&program.name);
304 writeln!(
305 out,
306 "pub const {source_const}: &str = include_str!(\"{}\");",
307 program.source
308 )
309 .expect("write");
310 if let (Some(name), Some(path)) = (&program.layout_const, &program.layout_path) {
311 writeln!(out, "pub const {name}: &str = include_str!(\"{path}\");").expect("write");
312 }
313 }
314
315 out.push_str("\npub static PROGRAMS: &[UserProgram] = &[\n");
316 for program in programs {
317 let install = match &program.install_path {
318 Some(path) => format!("Some(\"{}\")", escape(path)),
319 None => "None".to_owned(),
320 };
321 let layout = program.layout_const.as_deref().unwrap_or("\"\"");
322 writeln!(
323 out,
324 " UserProgram {{ name: \"{name}\", title: \"{title}\", description: \"{desc}\", \
325 kind: UserProgramKind::{kind}, install_path: {install}, source: {source}, \
326 source_path: \"{source_path}\", build_path: \"{build_path}\", \

Callers 1

render_userspaceFunction · 0.85

Calls 1

collectMethod · 0.80

Tested by

no test coverage detected