mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-06-14 21:01:02 +00:00
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:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user