Make Frame::fill take a generic Into<Fill>

This can be used to improve readability by using your own types.
This commit is contained in:
Héctor Ramón Jiménez 2020-04-14 06:37:27 +02:00
parent ce65097834
commit 2a795faf4e

View File

@ -89,14 +89,14 @@ impl Frame {
///
/// [`Path`]: path/struct.Path.html
/// [`Frame`]: struct.Frame.html
pub fn fill(&mut self, path: &Path, fill: Fill) {
pub fn fill(&mut self, path: &Path, fill: impl Into<Fill>) {
use lyon::tessellation::{
BuffersBuilder, FillOptions, FillTessellator,
};
let mut buffers = BuffersBuilder::new(
&mut self.buffers,
FillVertex(match fill {
FillVertex(match fill.into() {
Fill::Color(color) => color.into_linear(),
}),
);