pub fn try_update_comments(&mut self) {
        let mut new_comments = vec![];
        // limit the number of top comments updated each time
        let mut limit = 5;
        while !self.receiver.is_empty() && limit > 0 {
            if let Ok(mut comments) = self.receiver.try_recv() {
                new_comments.append(&mut comments);
            }
            limit -= 1;
        }

        if new_comments.is_empty() {
            return;
        }

        new_comments.iter().for_each(|comment| {
            let text_view = text_view::TextView::new(comment.text.clone());
            self.add_item(HideableView::new(PaddedView::lrtb(
                comment.height * 2 + 1,
                1,
                0,
                1,
                if comment.height > 0 {
                    // get the padding style (color) based on the comment's height
                    //
                    // We use base 16 colors to display the comment's padding
                    let c = config::Color::from((comment.height % 16) as u8);
                    text_view
                        .padding(TextPadding::default().left(StyledPaddingChar::new('▎', c.into())))
                } else {
                    // add top padding for top comments, use the first color in the 16 base colors
                    let c = config::Color::from(0);
                    text_view
                        .padding(TextPadding::default().top(StyledPaddingChar::new('▔', c.into())))
                },
            )));
        });
        self.comments.append(&mut new_comments);

        self.layout(self.get_scroller().last_outer_size())
    }
/// Check the `CommentReceiver` channel if there are new comments loaded
/// then update the internal comment data accordingly.
Check the `CommentReceiver` channel if there are new comments loaded
then update the internal comment data accordingly.
Check the ` CommentReceiver ` channel if there are new comments loaded then update the internal comment data accordingly .
pub fn try_update_comments(&mut self) {
        let mut new_comments = vec![];
        // limit the number of top comments updated each time
        let mut limit = 5;
        while !self.receiver.is_empty() && limit > 0 {
            if let Ok(mut comments) = self.receiver.try_recv() {
                new_comments.append(&mut comments);
            }
            limit -= 1;
        }
        if new_comments.is_empty() {
            return;
        }
        new_comments.iter().for_each(|comment| {
            let text_view = text_view::TextView::new(comment.text.clone());
            self.add_item(HideableView::new(PaddedView::lrtb(
                comment.height * 2 + 1,
                1,
                0,
                1,
                if comment.height > 0 {
                    // get the padding style (color) based on the comment's height
                    //
                    // We use base 16 colors to display the comment's padding
                    let c = config::Color::from((comment.height % 16) as u8);
                    text_view
                        .padding(TextPadding::default().left(StyledPaddingChar::new('▎', c.into())))
                } else {
                    // add top padding for top comments, use the first color in the 16 base colors
                    let c = config::Color::from(0);
                    text_view
                        .padding(TextPadding::default().top(StyledPaddingChar::new('▔', c.into())))
                },
            )));
        });
        self.comments.append(&mut new_comments);
        self.layout(self.get_scroller().last_outer_size())
    }
pub fn try_update_comments ( & mut self ) { let mut new_comments = vec ! [ ] ; // limit the number of top comments updated each time let mut limit = 5 ; while ! self . receiver . is_empty ( ) && limit > 0 { if let Ok ( mut comments ) = self . receiver . try_recv ( ) { new_comments . append ( & mut comments ) ; } limit -= 1 ; } if new_comments . is_empty ( ) { return ; } new_comments . iter ( ) . for_each ( | comment | { let text_view = text_view :: TextView :: new ( comment . text . clone ( ) ) ; self . add_item ( HideableView :: new ( PaddedView :: lrtb ( comment . height * 2 + 1 , 1 , 0 , 1 , if comment . height > 0 { // get the padding style (color) based on the comment's height // // We use base 16 colors to display the comment's padding let c = config :: Color :: from ( ( comment . height % 16 ) as u8 ) ; text_view . padding ( TextPadding :: default ( ) . left ( StyledPaddingChar :: new ( '▎',  c i n to() ) ) ) } else { // add top padding for top comments, use the first color in the 16 base colors let c = config :: Color :: from ( 0 ) ; text_view . padding ( TextPadding :: default ( ) . top ( StyledPaddingChar :: new ( '▔',  c i n to() ) ) ) } , ) ) ) ; } ) ; self . comments . append ( & mut new_comments ) ; self . layout ( self . get_scroller ( ) . last_outer_size ( ) ) }
Check the `CommentReceiver` channel if there are new comments loaded
then update the internal comment data accordingly.
Check the ` CommentReceiver ` channel if there are new comments loaded then update the internal comment data accordingly .
&mut self