diff --git a/serde/src/ser/mod.rs b/serde/src/ser/mod.rs index b787437e..d6ee65ae 100644 --- a/serde/src/ser/mod.rs +++ b/serde/src/ser/mod.rs @@ -881,6 +881,22 @@ pub trait Serializer: Sized { /// using [`serialize_seq`]. Implementors should not need to override this /// method. /// + /// ```rust + /// use serde::{Serialize, Serializer}; + /// + /// struct SecretlyOneHigher { + /// data: Vec, + /// } + /// + /// impl Serialize for SecretlyOneHigher { + /// fn serialize(&self, serializer: S) -> Result + /// where S: Serializer + /// { + /// serializer.collect_seq(self.data.iter().map(|x| x + 1)) + /// } + /// } + /// ``` + /// /// [`serialize_seq`]: #tymethod.serialize_seq fn collect_seq(self, iter: I) -> Result where