@@ -183,3 +183,161 @@ impl ItemInfoAlignmentTest {
183183 #[ deprecated]
184184 pub fn bar ( ) { }
185185}
186+
187+ pub mod scroll_traits {
188+ use std:: iter:: * ;
189+
190+ /// Shamelessly (partially) copied from `std::iter::Iterator`.
191+ /// It allows us to check that the scroll is working as expected on "hidden" items.
192+ pub trait Iterator {
193+ type Item ;
194+
195+ fn next ( & mut self ) -> Option < Self :: Item > ;
196+ fn size_hint ( & self ) -> ( usize , Option < usize > ) ;
197+ fn count ( self ) -> usize
198+ where
199+ Self : Sized ;
200+ fn last ( self ) -> Option < Self :: Item >
201+ where
202+ Self : Sized ;
203+ fn advance_by ( & mut self , n : usize ) -> Result < ( ) , usize > ;
204+ fn nth ( & mut self , n : usize ) -> Option < Self :: Item > ;
205+ fn step_by ( self , step : usize ) -> StepBy < Self >
206+ where
207+ Self : Sized ;
208+ fn chain < U > ( self , other : U ) -> Chain < Self , U :: IntoIter >
209+ where
210+ Self : Sized ,
211+ U : IntoIterator < Item = Self :: Item > ;
212+ fn zip < U > ( self , other : U ) -> Zip < Self , U :: IntoIter >
213+ where
214+ Self : Sized ,
215+ U : IntoIterator ;
216+ fn intersperse ( self , separator : Self :: Item ) -> Intersperse < Self >
217+ where
218+ Self : Sized ,
219+ Self :: Item : Clone ;
220+ fn intersperse_with < G > ( self , separator : G ) -> IntersperseWith < Self , G >
221+ where
222+ Self : Sized ,
223+ G : FnMut ( ) -> Self :: Item ;
224+ fn map < B , F > ( self , f : F ) -> Map < Self , F >
225+ where
226+ Self : Sized ,
227+ F : FnMut ( Self :: Item ) -> B ;
228+ fn for_each < F > ( self , f : F )
229+ where
230+ Self : Sized ,
231+ F : FnMut ( Self :: Item ) ;
232+ fn filter < P > ( self , predicate : P ) -> Filter < Self , P >
233+ where
234+ Self : Sized ,
235+ P : FnMut ( & Self :: Item ) -> bool ;
236+ fn filter_map < B , F > ( self , f : F ) -> FilterMap < Self , F >
237+ where
238+ Self : Sized ,
239+ F : FnMut ( Self :: Item ) -> Option < B > ;
240+ fn enumerate ( self ) -> Enumerate < Self >
241+ where
242+ Self : Sized ;
243+ fn peekable ( self ) -> Peekable < Self >
244+ where
245+ Self : Sized ;
246+ fn skip_while < P > ( self , predicate : P ) -> SkipWhile < Self , P >
247+ where
248+ Self : Sized ,
249+ P : FnMut ( & Self :: Item ) -> bool ;
250+ fn take_while < P > ( self , predicate : P ) -> TakeWhile < Self , P >
251+ where
252+ Self : Sized ,
253+ P : FnMut ( & Self :: Item ) -> bool ;
254+ fn map_while < B , P > ( self , predicate : P ) -> MapWhile < Self , P >
255+ where
256+ Self : Sized ,
257+ P : FnMut ( Self :: Item ) -> Option < B > ;
258+ fn skip ( self , n : usize ) -> Skip < Self >
259+ where
260+ Self : Sized ;
261+ fn take ( self , n : usize ) -> Take < Self >
262+ where
263+ Self : Sized ;
264+ fn scan < St , B , F > ( self , initial_state : St , f : F ) -> Scan < Self , St , F >
265+ where
266+ Self : Sized ,
267+ F : FnMut ( & mut St , Self :: Item ) -> Option < B > ;
268+ fn flat_map < U , F > ( self , f : F ) -> FlatMap < Self , U , F >
269+ where
270+ Self : Sized ,
271+ U : IntoIterator ,
272+ F : FnMut ( Self :: Item ) -> U ;
273+ fn flatten ( self ) -> Flatten < Self >
274+ where
275+ Self : Sized ,
276+ Self :: Item : IntoIterator ;
277+ fn fuse ( self ) -> Fuse < Self >
278+ where
279+ Self : Sized ;
280+ fn inspect < F > ( self , f : F ) -> Inspect < Self , F >
281+ where
282+ Self : Sized ,
283+ F : FnMut ( & Self :: Item ) ;
284+ fn by_ref ( & mut self ) -> & mut Self
285+ where
286+ Self : Sized ;
287+ fn collect < B : FromIterator < Self :: Item > > ( self ) -> B
288+ where
289+ Self : Sized ;
290+ fn collect_into < E : Extend < Self :: Item > > ( self , collection : & mut E ) -> & mut E
291+ where
292+ Self : Sized ;
293+ fn partition < B , F > ( self , f : F ) -> ( B , B )
294+ where
295+ Self : Sized ,
296+ B : Default + Extend < Self :: Item > ,
297+ F : FnMut ( & Self :: Item ) -> bool ;
298+ fn partition_in_place < ' a , T : ' a , P > ( mut self , predicate : P ) -> usize
299+ where
300+ Self : Sized + DoubleEndedIterator < Item = & ' a mut T > ,
301+ P : FnMut ( & T ) -> bool ;
302+ fn is_partitioned < P > ( mut self , mut predicate : P ) -> bool
303+ where
304+ Self : Sized ,
305+ P : FnMut ( Self :: Item ) -> bool ;
306+ fn fold < B , F > ( mut self , init : B , mut f : F ) -> B
307+ where
308+ Self : Sized ,
309+ F : FnMut ( B , Self :: Item ) -> B ;
310+ fn reduce < F > ( mut self , f : F ) -> Option < Self :: Item >
311+ where
312+ Self : Sized ,
313+ F : FnMut ( Self :: Item , Self :: Item ) -> Self :: Item ;
314+ fn all < F > ( & mut self , f : F ) -> bool
315+ where
316+ Self : Sized ,
317+ F : FnMut ( Self :: Item ) -> bool ;
318+ fn any < F > ( & mut self , f : F ) -> bool
319+ where
320+ Self : Sized ,
321+ F : FnMut ( Self :: Item ) -> bool ;
322+ fn find < P > ( & mut self , predicate : P ) -> Option < Self :: Item >
323+ where
324+ Self : Sized ,
325+ P : FnMut ( & Self :: Item ) -> bool ;
326+ fn find_map < B , F > ( & mut self , f : F ) -> Option < B >
327+ where
328+ Self : Sized ,
329+ F : FnMut ( Self :: Item ) -> Option < B > ;
330+ fn position < P > ( & mut self , predicate : P ) -> Option < usize >
331+ where
332+ Self : Sized ,
333+ P : FnMut ( Self :: Item ) -> bool ;
334+ /// We will scroll to "string" to ensure it scrolls as expected.
335+ fn this_is_a_method_with_a_long_name_returning_something ( ) -> String ;
336+ }
337+
338+ /// This one doesn't have hidden items (because there are too many) so we can also confirm that it
339+ /// scrolls as expected.
340+ pub trait TraitWithLongItemsName {
341+ fn this_is_a_method_with_a_long_name_returning_something ( ) -> String ;
342+ }
343+ }
0 commit comments