konst::primitive

Function parse_u16

Source
pub const fn parse_u16(s: &str) -> Result<u16, ParseIntError>
Expand description

Parses a u16 from a &str.

This returns an Err if the string would not successfully .parse() into a u16.

To parse a u16 from only part of a string, you can use Parser::parse_u16.

§Const stabilization

The equivalent std function, was const-stabilized in Rust 1.82.0.

§Example

For an example of how to use this function, you can look at the one for u128.