Skip to content

Commit

Permalink
Add from<&String> to QAnyStringView
Browse files Browse the repository at this point in the history
Makes constructing a QAnyStringView from String slightly less verbose
  • Loading branch information
nicolasfella committed Nov 17, 2024
1 parent 39b3264 commit ed664b2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions crates/cxx-qt-lib/src/core/qanystringview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ impl<'a> From<&'a str> for QAnyStringView<'a> {
}
}

impl<'a> From<&'a String> for QAnyStringView<'a> {
/// Constructs a QAnyStringView from a &String
fn from(string: &'a String) -> Self {
string.as_str().into()
}
}

impl From<&QString> for QAnyStringView<'_> {
/// Constructs a QAnyStringView from a QString
fn from(string: &QString) -> Self {
Expand Down

0 comments on commit ed664b2

Please sign in to comment.