opencv_binding_generator/writer/rust_native/string_ext.rs
1use std::borrow::Cow;
2
3use crate::{NameStyle, StrExt};
4
5pub trait RustStringExt {
6 fn rust_name_from_fullname(&self, style: NameStyle) -> Cow<'_, str>;
7}
8
9impl RustStringExt for str {
10 fn rust_name_from_fullname(&self, style: NameStyle) -> Cow<'_, str> {
11 match style {
12 NameStyle::Declaration => self.localname().into(),
13 NameStyle::Reference(fish) => fish.apply(self),
14 }
15 }
16}