@@ -90,21 +90,21 @@ impl<T: ?Sized> ListEntry<T> {
9090/// # Invariants
9191///
9292/// The links of objects added to a list are owned by the list.
93- pub ( crate ) struct RawList < G : GetLinks > {
93+ pub struct RawList < G : GetLinks > {
9494 head : Option < NonNull < G :: EntryType > > ,
9595}
9696
9797impl < G : GetLinks > RawList < G > {
98- pub ( crate ) const fn new ( ) -> Self {
98+ pub const fn new ( ) -> Self {
9999 Self { head : None }
100100 }
101101
102102 /// Returns an iterator for the list starting at the first entry.
103- pub ( crate ) fn iter ( & self ) -> Iterator < ' _ , G > {
103+ pub fn iter ( & self ) -> Iterator < ' _ , G > {
104104 Iterator :: new ( self . cursor_front ( ) , self . cursor_back ( ) )
105105 }
106106
107- pub ( crate ) const fn is_empty ( & self ) -> bool {
107+ pub const fn is_empty ( & self ) -> bool {
108108 self . head . is_none ( )
109109 }
110110
@@ -135,11 +135,7 @@ impl<G: GetLinks> RawList<G> {
135135 /// # Safety
136136 ///
137137 /// Callers must ensure that `existing` points to a valid entry that is on the list.
138- pub ( crate ) unsafe fn insert_after (
139- & mut self ,
140- existing : & G :: EntryType ,
141- new : & G :: EntryType ,
142- ) -> bool {
138+ pub unsafe fn insert_after ( & mut self , existing : & G :: EntryType , new : & G :: EntryType ) -> bool {
143139 let links = G :: get_links ( new) ;
144140 if !links. acquire_for_insertion ( ) {
145141 // Nothing to do if already inserted.
@@ -180,11 +176,11 @@ impl<G: GetLinks> RawList<G> {
180176 true
181177 }
182178
183- pub ( crate ) unsafe fn push_back ( & mut self , new : & G :: EntryType ) -> bool {
179+ pub unsafe fn push_back ( & mut self , new : & G :: EntryType ) -> bool {
184180 self . push_back_internal ( new, false )
185181 }
186182
187- pub ( crate ) unsafe fn push_front ( & mut self , new : & G :: EntryType ) -> bool {
183+ pub unsafe fn push_front ( & mut self , new : & G :: EntryType ) -> bool {
188184 self . push_back_internal ( new, true )
189185 }
190186
@@ -232,7 +228,7 @@ impl<G: GetLinks> RawList<G> {
232228 ///
233229 /// Callers must ensure that `data` is either on this list or in no list. It being on another
234230 /// list leads to memory unsafety.
235- pub ( crate ) unsafe fn remove ( & mut self , data : & G :: EntryType ) -> bool {
231+ pub unsafe fn remove ( & mut self , data : & G :: EntryType ) -> bool {
236232 self . remove_internal ( data)
237233 }
238234
@@ -244,7 +240,7 @@ impl<G: GetLinks> RawList<G> {
244240 }
245241
246242 /// Get and Remove the first element of the list.
247- pub ( crate ) fn pop_front ( & mut self ) -> Option < NonNull < G :: EntryType > > {
243+ pub fn pop_front ( & mut self ) -> Option < NonNull < G :: EntryType > > {
248244 self . pop_front_internal ( )
249245 }
250246
@@ -270,7 +266,7 @@ impl<G: GetLinks> RawList<G> {
270266 }
271267
272268 /// Returns a mut cursor starting on the first element of the list.
273- pub ( crate ) fn cursor_front_mut ( & mut self ) -> CursorMut < ' _ , G > {
269+ pub fn cursor_front_mut ( & mut self ) -> CursorMut < ' _ , G > {
274270 CursorMut :: new ( self , self . front ( ) )
275271 }
276272}
@@ -361,7 +357,7 @@ impl<'a, G: GetLinks> Cursor<'a, G> {
361357 }
362358}
363359
364- pub ( crate ) struct CursorMut < ' a , G : GetLinks > {
360+ pub struct CursorMut < ' a , G : GetLinks > {
365361 cursor : CommonCursor < G > ,
366362 list : & ' a mut RawList < G > ,
367363}
@@ -374,42 +370,42 @@ impl<'a, G: GetLinks> CursorMut<'a, G> {
374370 }
375371 }
376372
377- pub ( crate ) fn current ( & mut self ) -> Option < & mut G :: EntryType > {
373+ pub fn current ( & mut self ) -> Option < & mut G :: EntryType > {
378374 let cur = self . cursor . cur ?;
379375 // SAFETY: Objects must be kept alive while on the list.
380376 Some ( unsafe { & mut * cur. as_ptr ( ) } )
381377 }
382378
383379 /// Removes the entry the cursor is pointing to and advances the cursor to the next entry. It
384380 /// returns a raw pointer to the removed element (if one is removed).
385- pub ( crate ) fn remove_current ( & mut self ) -> Option < NonNull < G :: EntryType > > {
381+ pub fn remove_current ( & mut self ) -> Option < NonNull < G :: EntryType > > {
386382 let entry = self . cursor . cur ?;
387383 self . cursor . move_next ( self . list ) ;
388384 // SAFETY: The entry is on the list as we just got it from there and it cannot change.
389385 unsafe { self . list . remove ( entry. as_ref ( ) ) } ;
390386 Some ( entry)
391387 }
392388
393- pub ( crate ) fn peek_next ( & mut self ) -> Option < & mut G :: EntryType > {
389+ pub fn peek_next ( & mut self ) -> Option < & mut G :: EntryType > {
394390 let mut new = CommonCursor :: new ( self . cursor . cur ) ;
395391 new. move_next ( self . list ) ;
396392 // SAFETY: Objects must be kept alive while on the list.
397393 Some ( unsafe { & mut * new. cur ?. as_ptr ( ) } )
398394 }
399395
400- pub ( crate ) fn peek_prev ( & mut self ) -> Option < & mut G :: EntryType > {
396+ pub fn peek_prev ( & mut self ) -> Option < & mut G :: EntryType > {
401397 let mut new = CommonCursor :: new ( self . cursor . cur ) ;
402398 new. move_prev ( self . list ) ;
403399 // SAFETY: Objects must be kept alive while on the list.
404400 Some ( unsafe { & mut * new. cur ?. as_ptr ( ) } )
405401 }
406402
407- pub ( crate ) fn move_next ( & mut self ) {
403+ pub fn move_next ( & mut self ) {
408404 self . cursor . move_next ( self . list ) ;
409405 }
410406
411407 #[ allow( dead_code) ]
412- pub ( crate ) fn move_prev ( & mut self ) {
408+ pub fn move_prev ( & mut self ) {
413409 self . cursor . move_prev ( self . list ) ;
414410 }
415411}
@@ -423,7 +419,7 @@ impl<'a, G: GetLinks> iter::IntoIterator for &'a RawList<G> {
423419}
424420
425421/// An iterator for the linked list.
426- pub ( crate ) struct Iterator < ' a , G : GetLinks > {
422+ pub struct Iterator < ' a , G : GetLinks > {
427423 cursor_front : Cursor < ' a , G > ,
428424 cursor_back : Cursor < ' a , G > ,
429425}
0 commit comments