Skip to content

Commit

Permalink
added simple example + fixed warning in ast.rs (#294)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cr0a3 authored May 25, 2024
1 parent 6dea4d2 commit ef3cb9f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,8 @@ fuzz = ["afl"]

[profile.release]
debug = true

[[example]]
name = "simple"
path = "examples/simple.rs"
required-features = ["std"]
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 ef3cb9f

Please sign in to comment.