razgad 0.1.0

A library for decoding, classifying, normalizing, and re-emitting mangled, decorated, and runtime symbol names across a wide spread of compiler, platform, and language ecosystems.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::{decode, schemes, Confidence, DetectedSymbol, Error, Scheme};

pub fn heuristic_decode_symbol(input: &str) -> Result<DetectedSymbol, Error> {
    let (scheme, confidence) = detect_scheme(input)?;
    let symbol = decode(scheme, input)?;
    Ok(DetectedSymbol {
        scheme,
        confidence,
        symbol,
    })
}

fn detect_scheme(input: &str) -> Result<(Scheme, Confidence), Error> {
    schemes::detect(input)
        .ok_or_else(|| Error::new(format!("unable to determine mangling scheme: {input}")))
}