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
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

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`
fn readable(self) -> Readable<Self> {
fn readable(self) -> Readable<Self> where Self: Sized {
Readable(self)
}
/// Marks `self` as using `is_human_readable == false`
fn compact(self) -> Compact<Self> {
fn compact(self) -> Compact<Self> where Self: Sized {
Compact(self)
}
}
impl<T> Configure for T {}
impl<T: ?Sized> Configure for T {}
impl<T: ?Sized> Serialize for Readable<T>
where