You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a struct with a scan<T: StrToInt>(&self, s: &str) -> Result<(T, &str), Error> method that parses an integer from the initial portion of s and returns the integer & the remainder of s
The following options can be set as fields of the struct (possibly via a builder interface?):
what base to use in the absence of a base prefix
Bases should be specified as a Base newtype around u32
impl TryFrom<u32> for Base, failing for 0, 1, and anything greater than 36
Give Base constants for common bases: DECIMAL, HEXADECIMAL, OCTAL, and BINARY
whether to allow a base prefix
whether to allow a base prefix for a different base than the "default" one
whether to require a base prefix?
whether to allow an uppercase base prefix
whether to allow underscores
whether to consume trailing underscores
Should this always be done?
whether to allow a sign
whether to allow a + sign
whether to allow -0 for unsigned types
The scanner will always consume as many digits as there are at the start of the string, even if doing so would cause an overflow/underflow.
The text was updated successfully, but these errors were encountered:
Add a struct with a
scan<T: StrToInt>(&self, s: &str) -> Result<(T, &str), Error>
method that parses an integer from the initial portion ofs
and returns the integer & the remainder ofs
The following options can be set as fields of the struct (possibly via a builder interface?):
Base
newtype aroundu32
impl TryFrom<u32> for Base
, failing for 0, 1, and anything greater than 36Base
constants for common bases:DECIMAL
,HEXADECIMAL
,OCTAL
, andBINARY
+
sign-0
for unsigned typesThe scanner will always consume as many digits as there are at the start of the string, even if doing so would cause an overflow/underflow.
The text was updated successfully, but these errors were encountered: