From 04d239c2c35d570a01cb871cf0381c34be55c6d6 Mon Sep 17 00:00:00 2001 From: Proxtx <39201896+Proxtx@users.noreply.github.com> Date: Sat, 3 Feb 2024 21:30:42 +0100 Subject: [PATCH] add FromIterator for CookieJar --- src/jar.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/jar.rs b/src/jar.rs index 29953103..16ed46a1 100644 --- a/src/jar.rs +++ b/src/jar.rs @@ -586,6 +586,18 @@ impl CookieJar { } } +use std::iter::FromIterator; + +impl FromIterator> for CookieJar { + fn from_iter>>(iter: T) -> Self { + let mut jar = Self::new(); + for cookie in iter.into_iter() { + jar.add_original(cookie); + } + jar + } +} + use std::collections::hash_set::Iter as HashSetIter; /// Iterator over the changes to a cookie jar.