Make Button::background generic

This commit is contained in:
Héctor Ramón Jiménez 2019-12-05 01:57:35 +01:00
parent f87ddf1056
commit e92ea48e88
7 changed files with 21 additions and 20 deletions

View file

@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- `Image::new` takes an `Into<image::Handle>` now instead of an `Into<String>`. [#90]
- `Button::background` takes an `Into<Background>` now instead of a `Background`.
### Fixed
- `Image` widget not keeping aspect ratio consistently. [#90]

View file

@ -89,8 +89,8 @@ impl<'a, Message, Renderer> Button<'a, Message, Renderer> {
///
/// [`Button`]: struct.Button.html
/// [`Background`]: ../../struct.Background.html
pub fn background(mut self, background: Background) -> Self {
self.background = Some(background);
pub fn background<T: Into<Background>>(mut self, background: T) -> Self {
self.background = Some(background.into());
self
}