mirror of
https://github.com/nushell/nushell.git
synced 2025-07-14 21:35:58 +02:00
* Fix new clippy warnings * Fork serde-hjson and bring in * Fork serde-hjson and bring in * Fix clippy lint again
39 lines
1.0 KiB
Rust
39 lines
1.0 KiB
Rust
#[macro_export]
|
|
/// Create a function to forward a specific serialize call to the generic deserialize
|
|
macro_rules! forward_to_deserialize {
|
|
($(
|
|
$name:ident ( $( $arg:ident : $ty:ty ),* );
|
|
)*) => {
|
|
$(
|
|
forward_to_deserialize!{
|
|
func: $name ( $( $arg: $ty ),* );
|
|
}
|
|
)*
|
|
};
|
|
|
|
(func: deserialize_enum ( $( $arg:ident : $ty:ty ),* );) => {
|
|
fn deserialize_enum<V>(
|
|
&mut self,
|
|
$(_: $ty,)*
|
|
_visitor: V,
|
|
) -> ::std::result::Result<V::Value, Self::Error>
|
|
where V: ::serde::de::EnumVisitor
|
|
{
|
|
Err(::serde::de::Error::invalid_type(::serde::de::Type::Enum))
|
|
}
|
|
};
|
|
|
|
(func: $name:ident ( $( $arg:ident : $ty:ty ),* );) => {
|
|
#[inline]
|
|
fn $name<V>(
|
|
&mut self,
|
|
$(_: $ty,)*
|
|
visitor: V,
|
|
) -> ::std::result::Result<V::Value, Self::Error>
|
|
where V: ::serde::de::Visitor
|
|
{
|
|
self.deserialize(visitor)
|
|
}
|
|
};
|
|
}
|