Skip to content

Commit 751b169

Browse files
committed
Add from(&String) to QAnyStringView
Makes constructing a QAnyStringView from String slightly less verbose
1 parent 39b3264 commit 751b169

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

crates/cxx-qt-lib/src/core/qanystringview.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,13 @@ impl<'a> From<&'a str> for QAnyStringView<'a> {
9595
}
9696
}
9797

98+
impl<'a> From<&'a String> for QAnyStringView<'a> {
99+
/// Constructs a QAnyStringView from a &String
100+
fn from(string: &'a String) -> Self {
101+
string.as_str().into()
102+
}
103+
}
104+
98105
impl From<&QString> for QAnyStringView<'_> {
99106
/// Constructs a QAnyStringView from a QString
100107
fn from(string: &QString) -> Self {

0 commit comments

Comments
 (0)