mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-24 19:18:00 +00:00
Call reserve() in DeserializeSeed example
This suggests calling `reserve()` in example code so that people who ~blindly copy it get faster code.
This commit is contained in:
committed by
GitHub
parent
845b900fd5
commit
41ffa6df7e
@@ -708,6 +708,11 @@ impl<T> DeserializeOwned for T where T: for<'de> Deserialize<'de> {}
|
||||
/// where
|
||||
/// A: SeqAccess<'de>,
|
||||
/// {
|
||||
/// // Decrease the number of reallocations if there are many elements
|
||||
/// if let Some(size_hint) = seq.size_hint() {
|
||||
/// self.0.reserve(size_hint);
|
||||
/// }
|
||||
///
|
||||
/// // Visit each element in the inner array and push it onto
|
||||
/// // the existing vector.
|
||||
/// while let Some(elem) = seq.next_element()? {
|
||||
|
||||
Reference in New Issue
Block a user