diff --git a/README.md b/README.md index deeb765..3bbc969 100644 --- a/README.md +++ b/README.md @@ -18,12 +18,10 @@ Library: ```rust use cwdemangle::demangle; -let symbol = "BuildLight__9CGuiLightCFv"; -if let Some(result) = demangle(symbol) { +if let Some(result) = demangle("BuildLight__9CGuiLightCFv") { println!("{}", result); - Ok(()) } else { - Err("Couldn't demangle symbol (not a C++ symbol?)") + eprintln!("Couldn't demangle symbol (not a C++ symbol?)"); } ``` diff --git a/src/lib.rs b/src/lib.rs index 39ef636..3a61842 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -518,5 +518,13 @@ mod tests { demangle("__dt__26__partial_array_destructorFv"), Some("__partial_array_destructor::~__partial_array_destructor(void)".to_string()) ); + assert_eq!( + demangle("__distance,1,Q24rstl52select1st>,Q24rstl21less<13TGameScriptId>,Q24rstl17rmemory_allocator>14const_iterator>__4rstlFQ34rstl195red_black_tree<13TGameScriptId,Q24rstl32pair<13TGameScriptId,9TUniqueId>,1,Q24rstl52select1st>,Q24rstl21less<13TGameScriptId>,Q24rstl17rmemory_allocator>14const_iteratorQ34rstl195red_black_tree<13TGameScriptId,Q24rstl32pair<13TGameScriptId,9TUniqueId>,1,Q24rstl52select1st>,Q24rstl21less<13TGameScriptId>,Q24rstl17rmemory_allocator>14const_iteratorQ24rstl20forward_iterator_tag"), + Some("rstl::__distance, 1, rstl::select1st>, rstl::less, rstl::rmemory_allocator>::const_iterator>(rstl::red_black_tree, 1, rstl::select1st>, rstl::less, rstl::rmemory_allocator>::const_iterator, rstl::red_black_tree, 1, rstl::select1st>, rstl::less, rstl::rmemory_allocator>::const_iterator, rstl::forward_iterator_tag)".to_string()) + ); + assert_eq!( + demangle("__ct__Q210Metrowerks683compressed_pair,Q33std131__multimap_do_transform,Q23std53allocator>,0>13value_compare,Q23std53allocator>>4node>,Q210Metrowerks337compressed_pair,PQ33std276__tree_deleter,Q33std131__multimap_do_transform,Q23std53allocator>,0>13value_compare,Q23std53allocator>>4node>>FRQ23std301allocator,Q33std131__multimap_do_transform,Q23std53allocator>,0>13value_compare,Q23std53allocator>>4node>Q210Metrowerks337compressed_pair,PQ33std276__tree_deleter,Q33std131__multimap_do_transform,Q23std53allocator>,0>13value_compare,Q23std53allocator>>4node>"), + Some("Metrowerks::compressed_pair, std::__multimap_do_transform, std::allocator>, 0>::value_compare, std::allocator>>::node>&, Metrowerks::compressed_pair, std::__tree_deleter, std::__multimap_do_transform, std::allocator>, 0>::value_compare, std::allocator>>::node*>>::compressed_pair(std::allocator, std::__multimap_do_transform, std::allocator>, 0>::value_compare, std::allocator>>::node>&, Metrowerks::compressed_pair, std::__tree_deleter, std::__multimap_do_transform, std::allocator>, 0>::value_compare, std::allocator>>::node*>)".to_string()) + ); } }