diff --git a/ruma-common/src/push.rs b/ruma-common/src/push.rs index f67d2f99..3cd34f78 100644 --- a/ruma-common/src/push.rs +++ b/ruma-common/src/push.rs @@ -81,6 +81,20 @@ impl Ruleset { } } +impl IntoIterator for Ruleset { + type Item = AnyPushRule; + type IntoIter = std::vec::IntoIter; + + fn into_iter(self) -> Self::IntoIter { + self.content.into_iter().map(Into::into) + .chain(self.override_.into_iter().map(Into::into)) + .chain(self.room.into_iter().map(Into::into)) + .chain(self.sender.into_iter().map(Into::into)) + .chain(self.underride.into_iter().map(Into::into)) + .collect::>().into_iter() + } +} + /// A push rule is a single rule that states under what conditions an event should be passed onto a /// push gateway and how the notification should be presented. ///