#quick #data-model #helper #subset #unsupported #reduced

serde_serializer_quick_unsupported

Helper for implementing a serializer that supports a reduced subset of the serde data model

3 releases

0.1.2 Dec 22, 2022
0.1.1 Oct 21, 2022
0.1.0 Oct 21, 2022

#1420 in Encoding

Download history 3107/week @ 2024-07-21 2508/week @ 2024-07-28 2238/week @ 2024-08-04 1839/week @ 2024-08-11 2658/week @ 2024-08-18 3327/week @ 2024-08-25 2873/week @ 2024-09-01 2799/week @ 2024-09-08 2472/week @ 2024-09-15 2388/week @ 2024-09-22 1897/week @ 2024-09-29 1082/week @ 2024-10-06 1279/week @ 2024-10-13 1538/week @ 2024-10-20 1158/week @ 2024-10-27 1371/week @ 2024-11-03

5,362 downloads per month
Used in 3 crates (2 directly)

LGPL-3.0-only

13KB
270 lines

serde_serializer_quick_unsupported

Crates.io License

Helper for implementing a serializer that supports a reduced subset of the serde data model

Often times you need to implement a serializer where a bunch of input types are unexpected/unsupported This convenience macro allows you to declare those more easily:

use serde_serializer_quick_unsupported::serializer_unsupported;

struct MySerializer;
impl serde::Serializer for MySerializer {
	type Ok = ();
	type Error = serde::de::value::Error;
	serializer_unsupported! {
		err = (<Self::Error as serde::ser::Error>::custom("Unexpected input"));
		bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str bytes none some unit unit_struct
		unit_variant newtype_struct newtype_variant seq tuple tuple_struct tuple_variant map struct
		struct_variant i128 u128
	}
}

Just remove the stuff you want to not error

No runtime deps