@@ -16,73 +16,91 @@ use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet};
1616
1717use super :: seal;
1818
19- pub trait AutoConceal {
20- fn conceal_all ( & mut self ) -> usize {
21- self . conceal_except ( & vec ! [ ] )
19+ pub trait ConcealState {
20+ fn conceal_state ( & mut self ) -> usize {
21+ self . conceal_state_except ( & vec ! [ ] )
2222 }
23- fn conceal_except ( & mut self , seals : & Vec < seal:: Confidential > ) -> usize ;
23+ fn conceal_state_except (
24+ & mut self ,
25+ seals : & Vec < seal:: Confidential > ,
26+ ) -> usize ;
2427}
2528
26- impl < T > AutoConceal for Vec < T >
29+ impl < T > ConcealState for Vec < T >
2730where
28- T : AutoConceal ,
31+ T : ConcealState ,
2932{
30- fn conceal_except ( & mut self , seals : & Vec < seal:: Confidential > ) -> usize {
33+ fn conceal_state_except (
34+ & mut self ,
35+ seals : & Vec < seal:: Confidential > ,
36+ ) -> usize {
3137 self . iter_mut ( )
32- . fold ( 0usize , |sum, item| sum + item. conceal_except ( seals) )
38+ . fold ( 0usize , |sum, item| sum + item. conceal_state_except ( seals) )
3339 }
3440}
3541
36- impl < T > AutoConceal for BTreeSet < T >
42+ impl < T > ConcealState for BTreeSet < T >
3743where
38- T : AutoConceal + Ord + Clone ,
44+ T : ConcealState + Ord + Clone ,
3945{
40- fn conceal_except ( & mut self , seals : & Vec < seal:: Confidential > ) -> usize {
46+ fn conceal_state_except (
47+ & mut self ,
48+ seals : & Vec < seal:: Confidential > ,
49+ ) -> usize {
4150 let mut count = 0 ;
4251 let mut new_self = BTreeSet :: < T > :: new ( ) ;
4352 for item in self . iter ( ) {
4453 let mut new_item = item. clone ( ) ;
45- count += new_item. conceal_except ( seals) ;
54+ count += new_item. conceal_state_except ( seals) ;
4655 new_self. insert ( new_item) ;
4756 }
4857 * self = new_self;
4958 count
5059 }
5160}
5261
53- impl < K , V > AutoConceal for BTreeMap < K , V >
62+ impl < K , V > ConcealState for BTreeMap < K , V >
5463where
55- V : AutoConceal ,
64+ V : ConcealState ,
5665{
57- fn conceal_except ( & mut self , seals : & Vec < seal:: Confidential > ) -> usize {
66+ fn conceal_state_except (
67+ & mut self ,
68+ seals : & Vec < seal:: Confidential > ,
69+ ) -> usize {
5870 self . iter_mut ( )
59- . fold ( 0usize , |sum, item| sum + item. 1 . conceal_except ( seals) )
71+ . fold ( 0usize , |sum, item| sum + item. 1 . conceal_state_except ( seals) )
6072 }
6173}
6274
63- impl < T > AutoConceal for HashSet < T >
75+ impl < T > ConcealState for HashSet < T >
6476where
65- T : AutoConceal + Ord + Clone + std:: hash:: Hash ,
77+ T : ConcealState + Ord + Clone + std:: hash:: Hash ,
6678{
67- fn conceal_except ( & mut self , seals : & Vec < seal:: Confidential > ) -> usize {
79+ fn conceal_state_except (
80+ & mut self ,
81+ seals : & Vec < seal:: Confidential > ,
82+ ) -> usize {
6883 let mut count = 0 ;
6984 let mut new_self = HashSet :: < T > :: new ( ) ;
7085 for item in self . iter ( ) {
7186 let mut new_item = item. clone ( ) ;
72- count += new_item. conceal_except ( seals) ;
87+ count += new_item. conceal_state_except ( seals) ;
7388 new_self. insert ( new_item) ;
7489 }
7590 * self = new_self;
7691 count
7792 }
7893}
7994
80- impl < K , V > AutoConceal for HashMap < K , V >
95+ impl < K , V > ConcealState for HashMap < K , V >
8196where
82- V : AutoConceal ,
97+ V : ConcealState ,
8398{
84- fn conceal_except ( & mut self , seals : & Vec < seal:: Confidential > ) -> usize {
99+ fn conceal_state_except (
100+ & mut self ,
101+ seals : & Vec < seal:: Confidential > ,
102+ ) -> usize {
85103 self . iter_mut ( )
86- . fold ( 0usize , |sum, item| sum + item. 1 . conceal_except ( seals) )
104+ . fold ( 0usize , |sum, item| sum + item. 1 . conceal_state_except ( seals) )
87105 }
88106}
0 commit comments