File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -127,6 +127,12 @@ pub fn demangle(s: &str) -> Demangle {
127
127
}
128
128
}
129
129
130
+ /// Error returned from the `try_demangle` function below when demangling fails.
131
+ #[ derive( Debug , Clone ) ]
132
+ pub struct TryDemangleError {
133
+ _priv : ( ) ,
134
+ }
135
+
130
136
/// The same as `demangle`, except return an `Err` if the string does not appear
131
137
/// to be a Rust symbol, rather than "demangling" the given string as a no-op.
132
138
///
@@ -141,12 +147,12 @@ pub fn demangle(s: &str) -> Demangle {
141
147
/// // While `demangle` will just pass the non-symbol through as a no-op.
142
148
/// assert_eq!(rustc_demangle::demangle(not_a_rust_symbol).as_str(), not_a_rust_symbol);
143
149
/// ```
144
- pub fn try_demangle ( s : & str ) -> Result < Demangle , ( ) > {
150
+ pub fn try_demangle ( s : & str ) -> Result < Demangle , TryDemangleError > {
145
151
let sym = demangle ( s) ;
146
152
if sym. valid {
147
153
Ok ( sym)
148
154
} else {
149
- Err ( ( ) )
155
+ Err ( TryDemangleError { _priv : ( ) } )
150
156
}
151
157
}
152
158
You can’t perform that action at this time.
0 commit comments