@@ -33,9 +33,7 @@ impl<W> RawBitSet<W> {
3333 pub ( crate ) fn domain_size ( & self ) -> usize {
3434 self . domain_size
3535 }
36- }
3736
38- impl < W > RawBitSet < W > {
3937 pub ( crate ) fn new_empty_in (
4038 domain_size : usize ,
4139 alloc_words : impl FnOnce ( usize , Word ) -> W ,
@@ -45,13 +43,14 @@ impl<W> RawBitSet<W> {
4543
4644 RawBitSet { domain_size, words }
4745 }
48- }
4946
50- impl < W : AsMut < [ Word ] > > RawBitSet < W > {
5147 pub ( crate ) fn new_filled_in (
5248 domain_size : usize ,
5349 alloc_words : impl FnOnce ( usize , Word ) -> W ,
54- ) -> Self {
50+ ) -> Self
51+ where
52+ W : AsMut < [ Word ] > ,
53+ {
5554 let num_words = num_words ( domain_size) ;
5655 let words = alloc_words ( num_words, !0 ) ;
5756
@@ -60,19 +59,30 @@ impl<W: AsMut<[Word]>> RawBitSet<W> {
6059
6160 this
6261 }
62+
63+ pub ( crate ) fn adjust_words_storage < W2 > (
64+ self ,
65+ adjust_words : impl FnOnce ( W ) -> W2 ,
66+ ) -> RawBitSet < W2 > {
67+ let Self { domain_size, words } = self ;
68+ RawBitSet { domain_size, words : adjust_words ( words) }
69+ }
6370}
6471
65- impl RawBitSet < Vec < Word > > {
72+ impl < W : From < Vec < Word > > > RawBitSet < W > {
6673 /// Creates a new, empty bitset with a given `domain_size`.
6774 #[ inline]
6875 pub ( crate ) fn new_empty ( domain_size : usize ) -> Self {
69- Self :: new_empty_in ( domain_size, |num_words, w| vec ! [ w; num_words] )
76+ Self :: new_empty_in ( domain_size, |num_words, w| W :: from ( vec ! [ w; num_words] ) )
7077 }
7178
7279 /// Creates a new, filled bitset with a given `domain_size`.
7380 #[ inline]
74- pub ( crate ) fn new_filled ( domain_size : usize ) -> Self {
75- Self :: new_filled_in ( domain_size, |num_words, w| vec ! [ w; num_words] )
81+ pub ( crate ) fn new_filled ( domain_size : usize ) -> Self
82+ where
83+ W : AsMut < [ Word ] > ,
84+ {
85+ Self :: new_filled_in ( domain_size, |num_words, w| W :: from ( vec ! [ w; num_words] ) )
7686 }
7787}
7888
0 commit comments