diff --git a/src/try_extend.rs b/src/try_extend.rs index f869c33ad29..e4952576859 100644 --- a/src/try_extend.rs +++ b/src/try_extend.rs @@ -10,3 +10,14 @@ where /// Extends a collection with elements from an iterator, returning an error if the operation fails. fn try_extend(&mut self, iter: I) -> PyResult<()>; } + +impl TryExtend for T +where + I: IntoIterator, + T: Extend, +{ + fn try_extend(&mut self, iter: I) -> PyResult<()> { + self.extend(iter); + Ok(()) + } +}