Loading crates/tor-chanmgr/src/mgr.rs +1 −1 Original line number Diff line number Diff line //! Abstract implementation of a channel manager #![allow(dead_code)] use crate::err::PendingChanError; use crate::{Error, Result}; Loading Loading @@ -85,6 +84,7 @@ impl<CF: ChannelFactory> AbstractChanMgr<CF> { } /// Remove every unusable entry from this channel manager. #[cfg(test)] pub(crate) fn remove_unusable_entries(&self) -> Result<()> { self.channels.remove_unusable() } Loading crates/tor-chanmgr/src/mgr/map.rs +3 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ pub(crate) enum ChannelState<C> { impl<C> ChannelState<C> { /// Create a new shallow copy of this ChannelState. #[cfg(test)] fn clone_ref(&self) -> Result<Self> { use ChannelState::*; match self { Loading Loading @@ -93,6 +94,7 @@ impl<C: AbstractChannel> ChannelMap<C> { } /// Return the channel state for the given identity, if any. #[cfg(test)] pub(crate) fn get(&self, ident: &C::Ident) -> Result<Option<ChannelState<C>>> { let map = self.channels.lock()?; map.get(ident).map(ChannelState::clone_ref).transpose() Loading @@ -117,6 +119,7 @@ impl<C: AbstractChannel> ChannelMap<C> { } /// Remove every unusable state from the map. #[cfg(test)] pub(crate) fn remove_unusable(&self) -> Result<()> { let mut map = self.channels.lock()?; map.retain(|_, state| match state { Loading Loading
crates/tor-chanmgr/src/mgr.rs +1 −1 Original line number Diff line number Diff line //! Abstract implementation of a channel manager #![allow(dead_code)] use crate::err::PendingChanError; use crate::{Error, Result}; Loading Loading @@ -85,6 +84,7 @@ impl<CF: ChannelFactory> AbstractChanMgr<CF> { } /// Remove every unusable entry from this channel manager. #[cfg(test)] pub(crate) fn remove_unusable_entries(&self) -> Result<()> { self.channels.remove_unusable() } Loading
crates/tor-chanmgr/src/mgr/map.rs +3 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ pub(crate) enum ChannelState<C> { impl<C> ChannelState<C> { /// Create a new shallow copy of this ChannelState. #[cfg(test)] fn clone_ref(&self) -> Result<Self> { use ChannelState::*; match self { Loading Loading @@ -93,6 +94,7 @@ impl<C: AbstractChannel> ChannelMap<C> { } /// Return the channel state for the given identity, if any. #[cfg(test)] pub(crate) fn get(&self, ident: &C::Ident) -> Result<Option<ChannelState<C>>> { let map = self.channels.lock()?; map.get(ident).map(ChannelState::clone_ref).transpose() Loading @@ -117,6 +119,7 @@ impl<C: AbstractChannel> ChannelMap<C> { } /// Remove every unusable state from the map. #[cfg(test)] pub(crate) fn remove_unusable(&self) -> Result<()> { let mut map = self.channels.lock()?; map.retain(|_, state| match state { Loading