1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use crate::{NameStyle, StrExt};
use std::borrow::Cow;

pub trait RustStringExt {
	fn rust_name_from_fullname(&self, style: NameStyle) -> Cow<str>;
}

impl RustStringExt for str {
	fn rust_name_from_fullname(&self, style: NameStyle) -> Cow<str> {
		match style {
			NameStyle::Declaration => self.localname().into(),
			NameStyle::Reference(fish) => fish.apply(self),
		}
	}
}