alloy-rs / alloy-rs/ruint

`base_convert`: Internalize this trick so the user won't have to worry about it.

Aperta
#67 0 commenti 0 reazioni 1 assegnatario Assegnata a @prestwich Vedi su GitHub
optimize tracker
Lingua principale
Rust
Stelle
225
Fork
70
Merge medio
16h 54m
PR unite (30g)
8

Descrizione

*On 2023-08-13 @prestwich wrote in [`55c5411`](https://github.com/recmo/uint/commit/55c5411476924097c5d471fbf7ceb3181951bf2c) “Merge pull request #293 from recmo/remco/base-to”:*

Internalize this trick so the user won't have to worry about it.
Panics

Panics if the base is less than 2.

```rust
/// little-endian order.
///
/// Pro tip: instead of setting `base = 10`, set it to the highest
/// power of `10` that still fits `u64`. This way much fewer iterations
/// are required to extract all the digits.
// OPT: Internalize this trick so the user won't have to worry about it.
/// # Panics
///
/// Panics if the base is less than 2.
#[inline]
pub fn to_base_le(&self, base: u64) -> impl Iterator {
assert!(base > 1);
SpigotLittle {
base,

```
*From [`src/base_convert.rs:46`](https://github.com/recmo/uint/blob/55c5411476924097c5d471fbf7ceb3181951bf2c/src/base_convert.rs#L46)*

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.