Allow serde_test::Configure to be dynamically sized

This is a more cautious choice for the trait. In the future we may need
a `whatever_ref(&self)` that works for !Sized types.
This commit is contained in:
David Tolnay
2017-11-06 22:40:04 -08:00
parent 16787318d1
commit 7a0397451e
+4 -4
View File
@@ -71,18 +71,18 @@ pub struct Compact<T: ?Sized>(T);
/// ); /// );
/// } /// }
/// ``` /// ```
pub trait Configure : Sized { pub trait Configure {
/// Marks `self` as using `is_human_readable == true` /// Marks `self` as using `is_human_readable == true`
fn readable(self) -> Readable<Self> { fn readable(self) -> Readable<Self> where Self: Sized {
Readable(self) Readable(self)
} }
/// Marks `self` as using `is_human_readable == false` /// Marks `self` as using `is_human_readable == false`
fn compact(self) -> Compact<Self> { fn compact(self) -> Compact<Self> where Self: Sized {
Compact(self) Compact(self)
} }
} }
impl<T> Configure for T {} impl<T: ?Sized> Configure for T {}
impl<T: ?Sized> Serialize for Readable<T> impl<T: ?Sized> Serialize for Readable<T>
where where