diff --git a/Cargo.toml b/Cargo.toml index be10b6a..f273cb5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -52,3 +52,8 @@ fuzz = ["afl"] [profile.release] debug = true + +[[example]] +name = "simple" +path = "examples/simple.rs" +required-features = ["std"] diff --git a/examples/simple.rs b/examples/simple.rs new file mode 100644 index 0000000..d8c3441 --- /dev/null +++ b/examples/simple.rs @@ -0,0 +1,15 @@ +use cpp_demangle::Symbol; + +pub fn main() -> Result<(), Box> { + + let mangled = b"_ZN5space3fooEibc"; + + let sym = Symbol::new(&mangled[..])?; + let demangled = sym.to_string(); + + println!("{}", demangled); + + assert_eq!(demangled, "space::foo(int, bool, char)"); + + Ok(()) +} diff --git a/src/ast.rs b/src/ast.rs index 3ac5a03..f58d2f6 100644 --- a/src/ast.rs +++ b/src/ast.rs @@ -355,6 +355,7 @@ trait ArgScope<'me, 'ctx>: fmt::Debug { fn get_template_arg(&'me self, index: usize) -> Result<(&'ctx TemplateArg, &'ctx TemplateArgs)>; + #[allow(unused)] /// Get the current scope's `index`th function argument's type. fn get_function_arg(&'me self, index: usize) -> Result<&'ctx Type>; }