#data-model #quick #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

#1355 in Encoding

Download history 206/week @ 2024-03-15 195/week @ 2024-03-22 216/week @ 2024-03-29 315/week @ 2024-04-05 167/week @ 2024-04-12 250/week @ 2024-04-19 295/week @ 2024-04-26 272/week @ 2024-05-03 365/week @ 2024-05-10 339/week @ 2024-05-17 284/week @ 2024-05-24 279/week @ 2024-05-31 415/week @ 2024-06-07 1014/week @ 2024-06-14 1343/week @ 2024-06-21 963/week @ 2024-06-28

3,810 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