Metadata-Version: 2.4
Name: pyderust
Version: 1.0.0
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
License-File: LICENSE
Summary: Python bindings for rustc-demangle crate
Author-email: Vedant Soni <vedusoni@gmail.com>
License: BSD-3-Clause
Requires-Python: >=3.9
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Homepage, https://github.com/tedanvosin/pyderust

# pyderust

Python bindings for the [`rustc-demangle`](https://crates.io/crates/rustc-demangle) crate.

## Installation

```bash
pip install pyderust
```

## Usage

```python
from pyderust import demangle, DemangleError

# Demangle a Rust symbol (legacy mangling)
demangle("_ZN3foo3barE")  # => "foo::bar"

# Demangle a v0 symbol
demangle("_RNvC4test4main")  # => "test::main"

# Include the hash suffix
demangle("_ZN3foo17h05af221e174051e8E", include_hash=True)  # => "foo::h05af221e174051e8"

# Without hash (default)
demangle("_ZN3foo17h05af221e174051e8E")  # => "foo"
```

## Error Handling

`DemangleError` is raised when a symbol cannot be demangled. It is a subclass of `ValueError`.

```python
from pyderust import demangle, DemangleError

try:
    demangle("not_a_rust_symbol")
except DemangleError as e:
    print(e)  # => "not a valid Rust mangled symbol: not_a_rust_symbol"
```

## Development

```bash
# Create a virtual environment and install dev dependencies
python -m venv .venv
source .venv/bin/activate
pip install maturin pytest

# Build and install in development mode
maturin develop

# Run tests
pytest
```

