(class_name: Option<&str>, name: &'a str)
| 2793 | } |
| 2794 | |
| 2795 | pub(crate) fn mangle_name<'a>(class_name: Option<&str>, name: &'a str) -> Cow<'a, str> { |
| 2796 | let class_name = match class_name { |
| 2797 | Some(n) => n, |
| 2798 | None => return name.into(), |
| 2799 | }; |
| 2800 | if !name.starts_with("__") || name.ends_with("__") || name.contains('.') { |
| 2801 | return name.into(); |
| 2802 | } |
| 2803 | // Strip leading underscores from class name |
| 2804 | let class_name = class_name.trim_start_matches('_'); |
| 2805 | let mut ret = String::with_capacity(1 + class_name.len() + name.len()); |
| 2806 | ret.push('_'); |
| 2807 | ret.push_str(class_name); |
| 2808 | ret.push_str(name); |
| 2809 | ret.into() |
| 2810 | } |
| 2811 | |
| 2812 | /// Selective mangling for type parameter scopes around generic classes. |
| 2813 | /// If `mangled_names` is Some, only mangle names that are in the set; |
no test coverage detected