OpenTabletDriver / TabletBot

OpenTabletDriver's Discord bot
0 stars 1 forks source link

remove useless allocations #37

Closed jamesbt365 closed 6 months ago

jamesbt365 commented 6 months ago

Adds nicer interaction handling for pagination, removes generics on pagination Context usage.

Uses ArrayString for component custom ids because we know the size they are going to be, allowing us to avoid a heap allocation.

switches foo.push_str(&format!("{}\n", bar)); with writeln!(foo, "{bar}") avoiding an allocation for the usage of format!.

The format! macro calls write! internally and skipping the middle man here lets us avoid an allocation of a string just to deref it after.