Skip to content

Commit e396c1f

Browse files
tmchowjkelleyrtp
andauthored
feat: add blanket IntoAttributeValue impl for references (#5447)
* feat: add blanket IntoAttributeValue impl for references Adds `impl<T: IntoAttributeValue + Clone> IntoAttributeValue for &T` so users don't need to explicitly dereference or clone when passing references to RSX attributes. Closes #5444 * use to-owned --------- Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
1 parent 95fdca3 commit e396c1f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/core/src/nodes.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,6 +1123,12 @@ impl<T: IntoAttributeValue> IntoAttributeValue for Option<T> {
11231123
}
11241124
}
11251125

1126+
impl<T: ToOwned<Owned = R>, R: IntoAttributeValue> IntoAttributeValue for &T {
1127+
fn into_value(self) -> AttributeValue {
1128+
self.to_owned().into_value()
1129+
}
1130+
}
1131+
11261132
pub struct AnyFmtMarker;
11271133
impl<T> IntoAttributeValue<AnyFmtMarker> for T
11281134
where

0 commit comments

Comments
 (0)