Skip to content

Commit

Permalink
added simple example + fixed warning in ast.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
Cr0a3 committed May 10, 2024
1 parent bfd256c commit 078d387
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
15 changes: 15 additions & 0 deletions examples/simple.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
use cpp_demangle::Symbol;

pub fn main() -> Result<(), Box<dyn std::error::Error>> {

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(())
}
1 change: 1 addition & 0 deletions src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
}
Expand Down

0 comments on commit 078d387

Please sign in to comment.