1use gdk_pixbuf;
6use glib::object::IsA;
7use glib::translate::*;
8use glib::GString;
9use gtk_sys;
10use pango;
11use std::cmp;
12use TextBuffer;
13use TextChildAnchor;
14use TextMark;
15use TextSearchFlags;
16use TextTag;
17
18glib_wrapper! {
19 #[derive(Debug, Hash)]
20 pub struct TextIter(Boxed<gtk_sys::GtkTextIter>);
21
22 match fn {
23 copy => |ptr| gtk_sys::gtk_text_iter_copy(mut_override(ptr)),
24 free => |ptr| gtk_sys::gtk_text_iter_free(ptr),
25 init => |_ptr| (),
26 clear => |_ptr| (),
27 get_type => || gtk_sys::gtk_text_iter_get_type(),
28 }
29}
30
31impl TextIter {
32 pub fn assign(&mut self, other: &TextIter) {
33 unsafe {
34 gtk_sys::gtk_text_iter_assign(self.to_glib_none_mut().0, other.to_glib_none().0);
35 }
36 }
37
38 pub fn backward_char(&mut self) -> bool {
39 unsafe {
40 from_glib(gtk_sys::gtk_text_iter_backward_char(
41 self.to_glib_none_mut().0,
42 ))
43 }
44 }
45
46 pub fn backward_chars(&mut self, count: i32) -> bool {
47 unsafe {
48 from_glib(gtk_sys::gtk_text_iter_backward_chars(
49 self.to_glib_none_mut().0,
50 count,
51 ))
52 }
53 }
54
55 pub fn backward_cursor_position(&mut self) -> bool {
56 unsafe {
57 from_glib(gtk_sys::gtk_text_iter_backward_cursor_position(
58 self.to_glib_none_mut().0,
59 ))
60 }
61 }
62
63 pub fn backward_cursor_positions(&mut self, count: i32) -> bool {
64 unsafe {
65 from_glib(gtk_sys::gtk_text_iter_backward_cursor_positions(
66 self.to_glib_none_mut().0,
67 count,
68 ))
69 }
70 }
71
72 pub fn backward_find_char<P: FnMut(char) -> bool>(
73 &mut self,
74 pred: P,
75 limit: Option<&TextIter>,
76 ) -> bool {
77 let pred_data: P = pred;
78 unsafe extern "C" fn pred_func<P: FnMut(char) -> bool>(
79 ch: u32,
80 user_data: glib_sys::gpointer,
81 ) -> glib_sys::gboolean {
82 let ch = from_glib(ch);
83 let callback: *mut P = user_data as *const _ as usize as *mut P;
84 let res = (*callback)(ch);
85 res.to_glib()
86 }
87 let pred = Some(pred_func::<P> as _);
88 let super_callback0: &P = &pred_data;
89 unsafe {
90 from_glib(gtk_sys::gtk_text_iter_backward_find_char(
91 self.to_glib_none_mut().0,
92 pred,
93 super_callback0 as *const _ as usize as *mut _,
94 limit.to_glib_none().0,
95 ))
96 }
97 }
98
99 pub fn backward_line(&mut self) -> bool {
100 unsafe {
101 from_glib(gtk_sys::gtk_text_iter_backward_line(
102 self.to_glib_none_mut().0,
103 ))
104 }
105 }
106
107 pub fn backward_lines(&mut self, count: i32) -> bool {
108 unsafe {
109 from_glib(gtk_sys::gtk_text_iter_backward_lines(
110 self.to_glib_none_mut().0,
111 count,
112 ))
113 }
114 }
115
116 pub fn backward_search(
117 &self,
118 str: &str,
119 flags: TextSearchFlags,
120 limit: Option<&TextIter>,
121 ) -> Option<(TextIter, TextIter)> {
122 unsafe {
123 let mut match_start = TextIter::uninitialized();
124 let mut match_end = TextIter::uninitialized();
125 let ret = from_glib(gtk_sys::gtk_text_iter_backward_search(
126 self.to_glib_none().0,
127 str.to_glib_none().0,
128 flags.to_glib(),
129 match_start.to_glib_none_mut().0,
130 match_end.to_glib_none_mut().0,
131 limit.to_glib_none().0,
132 ));
133 if ret {
134 Some((match_start, match_end))
135 } else {
136 None
137 }
138 }
139 }
140
141 pub fn backward_sentence_start(&mut self) -> bool {
142 unsafe {
143 from_glib(gtk_sys::gtk_text_iter_backward_sentence_start(
144 self.to_glib_none_mut().0,
145 ))
146 }
147 }
148
149 pub fn backward_sentence_starts(&mut self, count: i32) -> bool {
150 unsafe {
151 from_glib(gtk_sys::gtk_text_iter_backward_sentence_starts(
152 self.to_glib_none_mut().0,
153 count,
154 ))
155 }
156 }
157
158 pub fn backward_to_tag_toggle<P: IsA<TextTag>>(&mut self, tag: Option<&P>) -> bool {
159 unsafe {
160 from_glib(gtk_sys::gtk_text_iter_backward_to_tag_toggle(
161 self.to_glib_none_mut().0,
162 tag.map(|p| p.as_ref()).to_glib_none().0,
163 ))
164 }
165 }
166
167 pub fn backward_visible_cursor_position(&mut self) -> bool {
168 unsafe {
169 from_glib(gtk_sys::gtk_text_iter_backward_visible_cursor_position(
170 self.to_glib_none_mut().0,
171 ))
172 }
173 }
174
175 pub fn backward_visible_cursor_positions(&mut self, count: i32) -> bool {
176 unsafe {
177 from_glib(gtk_sys::gtk_text_iter_backward_visible_cursor_positions(
178 self.to_glib_none_mut().0,
179 count,
180 ))
181 }
182 }
183
184 pub fn backward_visible_line(&mut self) -> bool {
185 unsafe {
186 from_glib(gtk_sys::gtk_text_iter_backward_visible_line(
187 self.to_glib_none_mut().0,
188 ))
189 }
190 }
191
192 pub fn backward_visible_lines(&mut self, count: i32) -> bool {
193 unsafe {
194 from_glib(gtk_sys::gtk_text_iter_backward_visible_lines(
195 self.to_glib_none_mut().0,
196 count,
197 ))
198 }
199 }
200
201 pub fn backward_visible_word_start(&mut self) -> bool {
202 unsafe {
203 from_glib(gtk_sys::gtk_text_iter_backward_visible_word_start(
204 self.to_glib_none_mut().0,
205 ))
206 }
207 }
208
209 pub fn backward_visible_word_starts(&mut self, count: i32) -> bool {
210 unsafe {
211 from_glib(gtk_sys::gtk_text_iter_backward_visible_word_starts(
212 self.to_glib_none_mut().0,
213 count,
214 ))
215 }
216 }
217
218 pub fn backward_word_start(&mut self) -> bool {
219 unsafe {
220 from_glib(gtk_sys::gtk_text_iter_backward_word_start(
221 self.to_glib_none_mut().0,
222 ))
223 }
224 }
225
226 pub fn backward_word_starts(&mut self, count: i32) -> bool {
227 unsafe {
228 from_glib(gtk_sys::gtk_text_iter_backward_word_starts(
229 self.to_glib_none_mut().0,
230 count,
231 ))
232 }
233 }
234
235 #[cfg_attr(feature = "v3_20", deprecated)]
236 pub fn begins_tag<P: IsA<TextTag>>(&self, tag: Option<&P>) -> bool {
237 unsafe {
238 from_glib(gtk_sys::gtk_text_iter_begins_tag(
239 self.to_glib_none().0,
240 tag.map(|p| p.as_ref()).to_glib_none().0,
241 ))
242 }
243 }
244
245 pub fn can_insert(&self, default_editability: bool) -> bool {
246 unsafe {
247 from_glib(gtk_sys::gtk_text_iter_can_insert(
248 self.to_glib_none().0,
249 default_editability.to_glib(),
250 ))
251 }
252 }
253
254 fn compare(&self, rhs: &TextIter) -> i32 {
255 unsafe { gtk_sys::gtk_text_iter_compare(self.to_glib_none().0, rhs.to_glib_none().0) }
256 }
257
258 pub fn editable(&self, default_setting: bool) -> bool {
259 unsafe {
260 from_glib(gtk_sys::gtk_text_iter_editable(
261 self.to_glib_none().0,
262 default_setting.to_glib(),
263 ))
264 }
265 }
266
267 pub fn ends_line(&self) -> bool {
268 unsafe { from_glib(gtk_sys::gtk_text_iter_ends_line(self.to_glib_none().0)) }
269 }
270
271 pub fn ends_sentence(&self) -> bool {
272 unsafe { from_glib(gtk_sys::gtk_text_iter_ends_sentence(self.to_glib_none().0)) }
273 }
274
275 pub fn ends_tag<P: IsA<TextTag>>(&self, tag: Option<&P>) -> bool {
276 unsafe {
277 from_glib(gtk_sys::gtk_text_iter_ends_tag(
278 self.to_glib_none().0,
279 tag.map(|p| p.as_ref()).to_glib_none().0,
280 ))
281 }
282 }
283
284 pub fn ends_word(&self) -> bool {
285 unsafe { from_glib(gtk_sys::gtk_text_iter_ends_word(self.to_glib_none().0)) }
286 }
287
288 fn equal(&self, rhs: &TextIter) -> bool {
289 unsafe {
290 from_glib(gtk_sys::gtk_text_iter_equal(
291 self.to_glib_none().0,
292 rhs.to_glib_none().0,
293 ))
294 }
295 }
296
297 pub fn forward_char(&mut self) -> bool {
298 unsafe {
299 from_glib(gtk_sys::gtk_text_iter_forward_char(
300 self.to_glib_none_mut().0,
301 ))
302 }
303 }
304
305 pub fn forward_chars(&mut self, count: i32) -> bool {
306 unsafe {
307 from_glib(gtk_sys::gtk_text_iter_forward_chars(
308 self.to_glib_none_mut().0,
309 count,
310 ))
311 }
312 }
313
314 pub fn forward_cursor_position(&mut self) -> bool {
315 unsafe {
316 from_glib(gtk_sys::gtk_text_iter_forward_cursor_position(
317 self.to_glib_none_mut().0,
318 ))
319 }
320 }
321
322 pub fn forward_cursor_positions(&mut self, count: i32) -> bool {
323 unsafe {
324 from_glib(gtk_sys::gtk_text_iter_forward_cursor_positions(
325 self.to_glib_none_mut().0,
326 count,
327 ))
328 }
329 }
330
331 pub fn forward_find_char<P: FnMut(char) -> bool>(
332 &mut self,
333 pred: P,
334 limit: Option<&TextIter>,
335 ) -> bool {
336 let pred_data: P = pred;
337 unsafe extern "C" fn pred_func<P: FnMut(char) -> bool>(
338 ch: u32,
339 user_data: glib_sys::gpointer,
340 ) -> glib_sys::gboolean {
341 let ch = from_glib(ch);
342 let callback: *mut P = user_data as *const _ as usize as *mut P;
343 let res = (*callback)(ch);
344 res.to_glib()
345 }
346 let pred = Some(pred_func::<P> as _);
347 let super_callback0: &P = &pred_data;
348 unsafe {
349 from_glib(gtk_sys::gtk_text_iter_forward_find_char(
350 self.to_glib_none_mut().0,
351 pred,
352 super_callback0 as *const _ as usize as *mut _,
353 limit.to_glib_none().0,
354 ))
355 }
356 }
357
358 pub fn forward_line(&mut self) -> bool {
359 unsafe {
360 from_glib(gtk_sys::gtk_text_iter_forward_line(
361 self.to_glib_none_mut().0,
362 ))
363 }
364 }
365
366 pub fn forward_lines(&mut self, count: i32) -> bool {
367 unsafe {
368 from_glib(gtk_sys::gtk_text_iter_forward_lines(
369 self.to_glib_none_mut().0,
370 count,
371 ))
372 }
373 }
374
375 pub fn forward_search(
376 &self,
377 str: &str,
378 flags: TextSearchFlags,
379 limit: Option<&TextIter>,
380 ) -> Option<(TextIter, TextIter)> {
381 unsafe {
382 let mut match_start = TextIter::uninitialized();
383 let mut match_end = TextIter::uninitialized();
384 let ret = from_glib(gtk_sys::gtk_text_iter_forward_search(
385 self.to_glib_none().0,
386 str.to_glib_none().0,
387 flags.to_glib(),
388 match_start.to_glib_none_mut().0,
389 match_end.to_glib_none_mut().0,
390 limit.to_glib_none().0,
391 ));
392 if ret {
393 Some((match_start, match_end))
394 } else {
395 None
396 }
397 }
398 }
399
400 pub fn forward_sentence_end(&mut self) -> bool {
401 unsafe {
402 from_glib(gtk_sys::gtk_text_iter_forward_sentence_end(
403 self.to_glib_none_mut().0,
404 ))
405 }
406 }
407
408 pub fn forward_sentence_ends(&mut self, count: i32) -> bool {
409 unsafe {
410 from_glib(gtk_sys::gtk_text_iter_forward_sentence_ends(
411 self.to_glib_none_mut().0,
412 count,
413 ))
414 }
415 }
416
417 pub fn forward_to_end(&mut self) {
418 unsafe {
419 gtk_sys::gtk_text_iter_forward_to_end(self.to_glib_none_mut().0);
420 }
421 }
422
423 pub fn forward_to_line_end(&mut self) -> bool {
424 unsafe {
425 from_glib(gtk_sys::gtk_text_iter_forward_to_line_end(
426 self.to_glib_none_mut().0,
427 ))
428 }
429 }
430
431 pub fn forward_to_tag_toggle<P: IsA<TextTag>>(&mut self, tag: Option<&P>) -> bool {
432 unsafe {
433 from_glib(gtk_sys::gtk_text_iter_forward_to_tag_toggle(
434 self.to_glib_none_mut().0,
435 tag.map(|p| p.as_ref()).to_glib_none().0,
436 ))
437 }
438 }
439
440 pub fn forward_visible_cursor_position(&mut self) -> bool {
441 unsafe {
442 from_glib(gtk_sys::gtk_text_iter_forward_visible_cursor_position(
443 self.to_glib_none_mut().0,
444 ))
445 }
446 }
447
448 pub fn forward_visible_cursor_positions(&mut self, count: i32) -> bool {
449 unsafe {
450 from_glib(gtk_sys::gtk_text_iter_forward_visible_cursor_positions(
451 self.to_glib_none_mut().0,
452 count,
453 ))
454 }
455 }
456
457 pub fn forward_visible_line(&mut self) -> bool {
458 unsafe {
459 from_glib(gtk_sys::gtk_text_iter_forward_visible_line(
460 self.to_glib_none_mut().0,
461 ))
462 }
463 }
464
465 pub fn forward_visible_lines(&mut self, count: i32) -> bool {
466 unsafe {
467 from_glib(gtk_sys::gtk_text_iter_forward_visible_lines(
468 self.to_glib_none_mut().0,
469 count,
470 ))
471 }
472 }
473
474 pub fn forward_visible_word_end(&mut self) -> bool {
475 unsafe {
476 from_glib(gtk_sys::gtk_text_iter_forward_visible_word_end(
477 self.to_glib_none_mut().0,
478 ))
479 }
480 }
481
482 pub fn forward_visible_word_ends(&mut self, count: i32) -> bool {
483 unsafe {
484 from_glib(gtk_sys::gtk_text_iter_forward_visible_word_ends(
485 self.to_glib_none_mut().0,
486 count,
487 ))
488 }
489 }
490
491 pub fn forward_word_end(&mut self) -> bool {
492 unsafe {
493 from_glib(gtk_sys::gtk_text_iter_forward_word_end(
494 self.to_glib_none_mut().0,
495 ))
496 }
497 }
498
499 pub fn forward_word_ends(&mut self, count: i32) -> bool {
500 unsafe {
501 from_glib(gtk_sys::gtk_text_iter_forward_word_ends(
502 self.to_glib_none_mut().0,
503 count,
504 ))
505 }
506 }
507
508 pub fn get_buffer(&self) -> Option<TextBuffer> {
509 unsafe { from_glib_none(gtk_sys::gtk_text_iter_get_buffer(self.to_glib_none().0)) }
510 }
511
512 pub fn get_bytes_in_line(&self) -> i32 {
513 unsafe { gtk_sys::gtk_text_iter_get_bytes_in_line(self.to_glib_none().0) }
514 }
515
516 pub fn get_char(&self) -> Option<char> {
517 unsafe { from_glib(gtk_sys::gtk_text_iter_get_char(self.to_glib_none().0)) }
518 }
519
520 pub fn get_chars_in_line(&self) -> i32 {
521 unsafe { gtk_sys::gtk_text_iter_get_chars_in_line(self.to_glib_none().0) }
522 }
523
524 pub fn get_child_anchor(&self) -> Option<TextChildAnchor> {
525 unsafe {
526 from_glib_none(gtk_sys::gtk_text_iter_get_child_anchor(
527 self.to_glib_none().0,
528 ))
529 }
530 }
531
532 pub fn get_language(&self) -> Option<pango::Language> {
533 unsafe { from_glib_full(gtk_sys::gtk_text_iter_get_language(self.to_glib_none().0)) }
534 }
535
536 pub fn get_line(&self) -> i32 {
537 unsafe { gtk_sys::gtk_text_iter_get_line(self.to_glib_none().0) }
538 }
539
540 pub fn get_line_index(&self) -> i32 {
541 unsafe { gtk_sys::gtk_text_iter_get_line_index(self.to_glib_none().0) }
542 }
543
544 pub fn get_line_offset(&self) -> i32 {
545 unsafe { gtk_sys::gtk_text_iter_get_line_offset(self.to_glib_none().0) }
546 }
547
548 pub fn get_marks(&self) -> Vec<TextMark> {
549 unsafe {
550 FromGlibPtrContainer::from_glib_container(gtk_sys::gtk_text_iter_get_marks(
551 self.to_glib_none().0,
552 ))
553 }
554 }
555
556 pub fn get_offset(&self) -> i32 {
557 unsafe { gtk_sys::gtk_text_iter_get_offset(self.to_glib_none().0) }
558 }
559
560 pub fn get_pixbuf(&self) -> Option<gdk_pixbuf::Pixbuf> {
561 unsafe { from_glib_none(gtk_sys::gtk_text_iter_get_pixbuf(self.to_glib_none().0)) }
562 }
563
564 pub fn get_slice(&self, end: &TextIter) -> Option<GString> {
565 unsafe {
566 from_glib_full(gtk_sys::gtk_text_iter_get_slice(
567 self.to_glib_none().0,
568 end.to_glib_none().0,
569 ))
570 }
571 }
572
573 pub fn get_tags(&self) -> Vec<TextTag> {
574 unsafe {
575 FromGlibPtrContainer::from_glib_container(gtk_sys::gtk_text_iter_get_tags(
576 self.to_glib_none().0,
577 ))
578 }
579 }
580
581 pub fn get_text(&self, end: &TextIter) -> Option<GString> {
582 unsafe {
583 from_glib_full(gtk_sys::gtk_text_iter_get_text(
584 self.to_glib_none().0,
585 end.to_glib_none().0,
586 ))
587 }
588 }
589
590 pub fn get_toggled_tags(&self, toggled_on: bool) -> Vec<TextTag> {
591 unsafe {
592 FromGlibPtrContainer::from_glib_container(gtk_sys::gtk_text_iter_get_toggled_tags(
593 self.to_glib_none().0,
594 toggled_on.to_glib(),
595 ))
596 }
597 }
598
599 pub fn get_visible_line_index(&self) -> i32 {
600 unsafe { gtk_sys::gtk_text_iter_get_visible_line_index(self.to_glib_none().0) }
601 }
602
603 pub fn get_visible_line_offset(&self) -> i32 {
604 unsafe { gtk_sys::gtk_text_iter_get_visible_line_offset(self.to_glib_none().0) }
605 }
606
607 pub fn get_visible_slice(&self, end: &TextIter) -> Option<GString> {
608 unsafe {
609 from_glib_full(gtk_sys::gtk_text_iter_get_visible_slice(
610 self.to_glib_none().0,
611 end.to_glib_none().0,
612 ))
613 }
614 }
615
616 pub fn get_visible_text(&self, end: &TextIter) -> Option<GString> {
617 unsafe {
618 from_glib_full(gtk_sys::gtk_text_iter_get_visible_text(
619 self.to_glib_none().0,
620 end.to_glib_none().0,
621 ))
622 }
623 }
624
625 pub fn has_tag<P: IsA<TextTag>>(&self, tag: &P) -> bool {
626 unsafe {
627 from_glib(gtk_sys::gtk_text_iter_has_tag(
628 self.to_glib_none().0,
629 tag.as_ref().to_glib_none().0,
630 ))
631 }
632 }
633
634 pub fn in_range(&self, start: &TextIter, end: &TextIter) -> bool {
635 unsafe {
636 from_glib(gtk_sys::gtk_text_iter_in_range(
637 self.to_glib_none().0,
638 start.to_glib_none().0,
639 end.to_glib_none().0,
640 ))
641 }
642 }
643
644 pub fn inside_sentence(&self) -> bool {
645 unsafe {
646 from_glib(gtk_sys::gtk_text_iter_inside_sentence(
647 self.to_glib_none().0,
648 ))
649 }
650 }
651
652 pub fn inside_word(&self) -> bool {
653 unsafe { from_glib(gtk_sys::gtk_text_iter_inside_word(self.to_glib_none().0)) }
654 }
655
656 pub fn is_cursor_position(&self) -> bool {
657 unsafe {
658 from_glib(gtk_sys::gtk_text_iter_is_cursor_position(
659 self.to_glib_none().0,
660 ))
661 }
662 }
663
664 pub fn is_end(&self) -> bool {
665 unsafe { from_glib(gtk_sys::gtk_text_iter_is_end(self.to_glib_none().0)) }
666 }
667
668 pub fn is_start(&self) -> bool {
669 unsafe { from_glib(gtk_sys::gtk_text_iter_is_start(self.to_glib_none().0)) }
670 }
671
672 pub fn order(&mut self, second: &mut TextIter) {
673 unsafe {
674 gtk_sys::gtk_text_iter_order(self.to_glib_none_mut().0, second.to_glib_none_mut().0);
675 }
676 }
677
678 pub fn set_line(&mut self, line_number: i32) {
679 unsafe {
680 gtk_sys::gtk_text_iter_set_line(self.to_glib_none_mut().0, line_number);
681 }
682 }
683
684 pub fn set_line_index(&mut self, byte_on_line: i32) {
685 unsafe {
686 gtk_sys::gtk_text_iter_set_line_index(self.to_glib_none_mut().0, byte_on_line);
687 }
688 }
689
690 pub fn set_line_offset(&mut self, char_on_line: i32) {
691 unsafe {
692 gtk_sys::gtk_text_iter_set_line_offset(self.to_glib_none_mut().0, char_on_line);
693 }
694 }
695
696 pub fn set_offset(&mut self, char_offset: i32) {
697 unsafe {
698 gtk_sys::gtk_text_iter_set_offset(self.to_glib_none_mut().0, char_offset);
699 }
700 }
701
702 pub fn set_visible_line_index(&mut self, byte_on_line: i32) {
703 unsafe {
704 gtk_sys::gtk_text_iter_set_visible_line_index(self.to_glib_none_mut().0, byte_on_line);
705 }
706 }
707
708 pub fn set_visible_line_offset(&mut self, char_on_line: i32) {
709 unsafe {
710 gtk_sys::gtk_text_iter_set_visible_line_offset(self.to_glib_none_mut().0, char_on_line);
711 }
712 }
713
714 pub fn starts_line(&self) -> bool {
715 unsafe { from_glib(gtk_sys::gtk_text_iter_starts_line(self.to_glib_none().0)) }
716 }
717
718 pub fn starts_sentence(&self) -> bool {
719 unsafe {
720 from_glib(gtk_sys::gtk_text_iter_starts_sentence(
721 self.to_glib_none().0,
722 ))
723 }
724 }
725
726 #[cfg(any(feature = "v3_20", feature = "dox"))]
727 pub fn starts_tag<P: IsA<TextTag>>(&self, tag: Option<&P>) -> bool {
728 unsafe {
729 from_glib(gtk_sys::gtk_text_iter_starts_tag(
730 self.to_glib_none().0,
731 tag.map(|p| p.as_ref()).to_glib_none().0,
732 ))
733 }
734 }
735
736 pub fn starts_word(&self) -> bool {
737 unsafe { from_glib(gtk_sys::gtk_text_iter_starts_word(self.to_glib_none().0)) }
738 }
739
740 pub fn toggles_tag<P: IsA<TextTag>>(&self, tag: Option<&P>) -> bool {
741 unsafe {
742 from_glib(gtk_sys::gtk_text_iter_toggles_tag(
743 self.to_glib_none().0,
744 tag.map(|p| p.as_ref()).to_glib_none().0,
745 ))
746 }
747 }
748}
749
750impl PartialOrd for TextIter {
751 #[inline]
752 fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
753 self.compare(other).partial_cmp(&0)
754 }
755}
756
757impl Ord for TextIter {
758 #[inline]
759 fn cmp(&self, other: &Self) -> cmp::Ordering {
760 self.compare(other).cmp(&0)
761 }
762}
763
764impl PartialEq for TextIter {
765 #[inline]
766 fn eq(&self, other: &Self) -> bool {
767 self.equal(other)
768 }
769}
770
771impl Eq for TextIter {}