pub fn role_action_row(roles: &[db::Role]) -> Vec<Vec<CreateActionRow>> {
    // split into 5 roles for each action row
    let role_chunks = roles.chunks(5).collect::<Vec<_>>();
    // split into 2 action roles per page
    let row_chunks = role_chunks.chunks(2);

    // Create required amount of pages
    let mut pages: Vec<Vec<CreateActionRow>> = Vec::with_capacity(row_chunks.len());

    for rows in row_chunks {
        // add new page
        pages.push(Vec::with_capacity(4));
        let new_page = pages.last_mut().unwrap();

        for r in rows {
            // Create Action row with role buttons
            let mut ar = CreateActionRow::default();
            for role in r.iter() {
                ar.add_button(role_button(role));
            }
            new_page.push(ar);
        }
    }
    pages
}
// Only 5 buttons per row possible
// This pages. One page can have up to 4 rows with 5 roles each
// I only choose 2 rows. looks neater with embeds
Only 5 buttons per row possible
This pages. One page can have up to 4 rows with 5 roles each
I only choose 2 rows. looks neater with embeds
Only 5 buttons per row possible This pages . One page can have up to 4 rows with 5 roles each I only choose 2 rows . looks neater with embeds
pub fn role_action_row(roles: &[db::Role]) -> Vec<Vec<CreateActionRow>> {
    // split into 5 roles for each action row
    let role_chunks = roles.chunks(5).collect::<Vec<_>>();
    // split into 2 action roles per page
    let row_chunks = role_chunks.chunks(2);
    // Create required amount of pages
    let mut pages: Vec<Vec<CreateActionRow>> = Vec::with_capacity(row_chunks.len());
    for rows in row_chunks {
        // add new page
        pages.push(Vec::with_capacity(4));
        let new_page = pages.last_mut().unwrap();
        for r in rows {
            // Create Action row with role buttons
            let mut ar = CreateActionRow::default();
            for role in r.iter() {
                ar.add_button(role_button(role));
            }
            new_page.push(ar);
        }
    }
    pages
}
pub fn role_action_row ( roles : & [ db :: Role ] ) -> Vec < Vec < CreateActionRow > > { // split into 5 roles for each action row let role_chunks = roles . chunks ( 5 ) . collect :: < Vec < _ > > ( ) ; // split into 2 action roles per page let row_chunks = role_chunks . chunks ( 2 ) ; // Create required amount of pages let mut pages : Vec < Vec < CreateActionRow > > = Vec :: with_capacity ( row_chunks . len ( ) ) ; for rows in row_chunks { // add new page pages . push ( Vec :: with_capacity ( 4 ) ) ; let new_page = pages . last_mut ( ) . unwrap ( ) ; for r in rows { // Create Action row with role buttons let mut ar = CreateActionRow :: default ( ) ; for role in r . iter ( ) { ar . add_button ( role_button ( role ) ) ; } new_page . push ( ar ) ; } } pages }
Only 5 buttons per row possible
This pages.
Only 5 buttons per row possible This pages .
roles
&[db::Role]