pub struct Same;Expand description
The adapter that uses the type’s own implementation.
This forwards to Serialize and Deserialize. In
#[deser(as = ...)] attributes _ can be used instead.
use std::collections::BTreeMap;
use deser::Deserialize;
use deser::adapters::DisplayFromStr;
#[derive(Deserialize)]
pub struct Ports {
// same as BTreeMap<deser::adapters::Same, DisplayFromStr>
#[deser(as = BTreeMap<_, DisplayFromStr>)]
ports: BTreeMap<String, u16>,
}Trait Implementations§
Source§impl<'de, T: Deserialize<'de>> Deserialize<'de, T> for Same
impl<'de, T: Deserialize<'de>> Deserialize<'de, T> for Same
Source§fn deserialize_into<'out>(
out: &'out mut Option<T>,
state: &mut State,
) -> SinkHandle<'out, 'de>
fn deserialize_into<'out>( out: &'out mut Option<T>, state: &mut State, ) -> SinkHandle<'out, 'de>
Creates a sink that deserializes the value into the given slot. Read more
Source§fn expecting() -> Cow<'static, str>
fn expecting() -> Cow<'static, str>
Returns what the value expects, for error messages. Read more
Source§fn initial_value() -> Option<T>
fn initial_value() -> Option<T>
Provides the value of a missing struct field. Read more
Source§fn deserialize_update<'out>(
value: &'out mut T,
state: &mut State,
) -> SinkHandle<'out, 'de>
fn deserialize_update<'out>( value: &'out mut T, state: &mut State, ) -> SinkHandle<'out, 'de>
Creates a sink that updates an existing value. Read more
Source§fn describe_type(d: &mut dyn Describe)
fn describe_type(d: &mut dyn Describe)
Describes the Rust shape of the type. Read more
Source§impl<T: Serialize + ?Sized> Serialize<T> for Same
impl<T: Serialize + ?Sized> Serialize<T> for Same
Source§fn serialize<'a>(value: &'a T, state: &mut State) -> Result<Emit<'a>, Error>
fn serialize<'a>(value: &'a T, state: &mut State) -> Result<Emit<'a>, Error>
Serializes the value.
Source§fn finish(value: &T, state: &mut State) -> Result<(), Error>
fn finish(value: &T, state: &mut State) -> Result<(), Error>
Invoked after the serialization finished. Read more
Source§fn container_shape(value: &T) -> ContainerShape
fn container_shape(value: &T) -> ContainerShape
Returns the shape of the value if it’s a map or sequence. Read more
Auto Trait Implementations§
impl Freeze for Same
impl RefUnwindSafe for Same
impl Send for Same
impl Sync for Same
impl Unpin for Same
impl UnsafeUnpin for Same
impl UnwindSafe for Same
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more