Skip to content

Commit

Permalink
Makes TextFragment functions take Into<T>
Browse files Browse the repository at this point in the history
  • Loading branch information
nobbele committed Nov 6, 2021
1 parent 2d32e12 commit 24ff2e8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/graphics/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ impl TextFragment {
}

/// Set fragment's color, overrides text's color.
pub fn color(mut self, color: Color) -> TextFragment {
self.color = Some(color);
pub fn color<C: Into<Color>>(mut self, color: C) -> TextFragment {
self.color = Some(color.into());
self
}

Expand All @@ -87,9 +87,9 @@ impl TextFragment {
self
}

/// Set fragment's scale, overrides text's scale.
pub fn scale(mut self, scale: PxScale) -> TextFragment {
self.scale = Some(scale);
/// Set fragment's scale, overrides text's scale. Default is 16.0
pub fn scale<S: Into<PxScale>>(mut self, scale: S) -> TextFragment {
self.scale = Some(scale.into());
self
}
}
Expand Down

0 comments on commit 24ff2e8

Please sign in to comment.