From bac156bcf5854ae2fe28e40b66336c5b88f904d3 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 15 Aug 2023 13:05:53 -0400 Subject: [PATCH] cell: Add code to iterate over IntroEstablished extensions --- crates/tor-cell/semver.md | 1 + crates/tor-cell/src/relaycell/hs.rs | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/tor-cell/semver.md b/crates/tor-cell/semver.md index c8d977be2..d187e5957 100644 --- a/crates/tor-cell/semver.md +++ b/crates/tor-cell/semver.md @@ -1 +1,2 @@ ADDED: establish_intro functions now take any impl>. +ADDED: Iterator over IntroEstablishedExt. diff --git a/crates/tor-cell/src/relaycell/hs.rs b/crates/tor-cell/src/relaycell/hs.rs index 2aa07dc61..45510c8e9 100644 --- a/crates/tor-cell/src/relaycell/hs.rs +++ b/crates/tor-cell/src/relaycell/hs.rs @@ -310,7 +310,8 @@ decl_extension_group! { /// /// (Currently, no extensions of this type are recognized) #[derive(Debug,Clone)] - enum IntroEstablishedExt [ IntroEstablishedExtType ] { + #[non_exhaustive] + pub enum IntroEstablishedExt [ IntroEstablishedExtType ] { } } @@ -327,6 +328,11 @@ impl IntroEstablished { pub fn new() -> Self { Self::default() } + + /// Return an iterator over the extensions declared in this message. + pub fn iter_extensions(&self) -> impl Iterator { + self.extensions.iter() + } } impl Body for IntroEstablished {