style: Be a little less From-happy with rect.

This commit is contained in:
Emilio Cobos Álvarez 2017-09-16 17:29:43 +02:00
parent 7e4338eed8
commit 7a265793c8
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
4 changed files with 13 additions and 15 deletions

View file

@ -27,6 +27,11 @@ impl<T> Rect<T> {
impl<T> Rect<T>
where T: Clone
{
/// Returns a rect with all the values equal to `v`.
pub fn all(v: T) -> Self {
Rect::new(v.clone(), v.clone(), v.clone(), v)
}
/// Parses a new `Rect<T>` value with the given parse function.
pub fn parse_with<'i, 't, Parse>(
context: &ParserContext,
@ -53,15 +58,6 @@ impl<T> Rect<T>
}
}
impl<T> From<T> for Rect<T>
where T: Clone
{
#[inline]
fn from(value: T) -> Self {
Self::new(value.clone(), value.clone(), value.clone(), value)
}
}
impl<T> Parse for Rect<T>
where T: Clone + Parse
{