|
|
|
@ -241,11 +241,7 @@ impl<'a> ValueDecoder<'a> { |
|
|
|
|
|
|
|
/// Attempts to decode a value of the given type.
|
|
|
|
///
|
|
|
|
/// Allows easy decoding of complex values using type inference:
|
|
|
|
///
|
|
|
|
/// ```
|
|
|
|
/// let val: Foo = decoder.decode()?;
|
|
|
|
/// ```
|
|
|
|
/// Allows easy decoding of complex values using type inference.
|
|
|
|
pub fn decode<T: ValueDecode>(&mut self) -> Result<T, ValueDecodeError> {
|
|
|
|
T::decode_from(self)
|
|
|
|
}
|
|
|
|
@ -388,10 +384,7 @@ impl<'a> ValueEncoder<'a> { |
|
|
|
|
|
|
|
/// Encodes the given value into the underlying buffer.
|
|
|
|
///
|
|
|
|
/// Allows for easy encoding with type inference:
|
|
|
|
/// ```
|
|
|
|
/// encoder.encode(&Foo::new(bar))?;
|
|
|
|
/// ```
|
|
|
|
/// Allows for easy encoding with type inference.
|
|
|
|
pub fn encode<T: ValueEncode + ?Sized>(
|
|
|
|
&mut self,
|
|
|
|
val: &T,
|
|
|
|
|