Skip to content

Commit 0ad994d

Browse files
committed
Added readme to repository
1 parent e5fb0d9 commit 0ad994d

File tree

4 files changed

+61
-4
lines changed

4 files changed

+61
-4
lines changed

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ license = "MIT/NCSA"
77
documentation = "https://docs.rs/msvc-demangler/"
88
description = "A rust library that demangles / undecorates C++ symbols mangled by MSVC"
99
repository = "https://github.com/mstange/msvc-demangler-rust"
10+
readme = "README.md"
1011

1112
[dependencies]
1213
bitflags = "1.0.1"
1314

1415
[[bin]]
1516
name = "undname"
17+
path = "src/bin/undname.rs"

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,9 @@ test: test-cargo test-wasm-build
2828
lint:
2929
@rustup component add clippy --toolchain stable 2> /dev/null
3030
@cargo +stable clippy --all --tests -- -D clippy::all
31+
.PHONY: lint
32+
33+
update-readme:
34+
@cargo-readme -V &> /dev/null || cargo install cargo-readme
35+
@cargo readme > README.md
36+
.PHONY: update-readme

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# msvc-demangler
2+
3+
msvc-demangler is a crate for Rust that can demangle C++ symbols which use
4+
the MSVC mangling scheme. These are emitted by the Microsoft C++ compiler
5+
for Windows as well as some others.
6+
7+
## Example
8+
9+
```rust
10+
use msvc_demangler;
11+
let flags = msvc_demangler::DemangleFlags::llvm();
12+
let result = msvc_demangler::demangle("??_0klass@@QEAAHH@Z", flags).unwrap();
13+
println!("{}", result);
14+
```
15+
16+
## Behavior
17+
18+
It's functionality is similar to `undname` on Windows and the underlying
19+
`UnDecorateSymbolName` function. Since Microsoft does not document the
20+
mangling scheme this is likely not to be entirely accurate. When unclear
21+
the implementation tries to follow what LLVM does.
22+
23+
## License
24+
25+
This msvc-demangler is dual licensed under the MIT and the University of
26+
Illinois Open Source Licenses.
27+
28+
License: MIT/NCSA

src/lib.rs

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,27 @@
1-
// This file is dual licensed under the MIT and the University of Illinois Open
2-
// Source Licenses. See LICENSE.TXT for details.
3-
//
4-
// This file defines a demangler for MSVC-style mangled symbols.
1+
//! msvc-demangler is a crate for Rust that can demangle C++ symbols which use
2+
//! the MSVC mangling scheme. These are emitted by the Microsoft C++ compiler
3+
//! for Windows as well as some others.
4+
//!
5+
//! # Example
6+
//!
7+
//! ```
8+
//! use msvc_demangler;
9+
//! let flags = msvc_demangler::DemangleFlags::llvm();
10+
//! let result = msvc_demangler::demangle("??_0klass@@QEAAHH@Z", flags).unwrap();
11+
//! println!("{}", result);
12+
//! ```
13+
//!
14+
//! # Behavior
15+
//!
16+
//! It's functionality is similar to `undname` on Windows and the underlying
17+
//! `UnDecorateSymbolName` function. Since Microsoft does not document the
18+
//! mangling scheme this is likely not to be entirely accurate. When unclear
19+
//! the implementation tries to follow what LLVM does.
20+
//!
21+
//! # License
22+
//!
23+
//! This msvc-demangler is dual licensed under the MIT and the University of
24+
//! Illinois Open Source Licenses.
525
626
#[macro_use]
727
extern crate bitflags;
@@ -30,6 +50,7 @@ impl From<std::str::Utf8Error> for Error {
3050
}
3151
}
3252
}
53+
3354
impl From<std::string::FromUtf8Error> for Error {
3455
fn from(t: std::string::FromUtf8Error) -> Error {
3556
Error {

0 commit comments

Comments
 (0)