rustparse

package
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package rustparse parses numbers with Rust's str::parse grammar and error messages, so values the Rust CLI accepts or rejects behave the same in Go (strconv takes underscores, hex floats, and other forms Rust refuses, and words its errors differently).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Float

func Float(s string) (float64, error)

Float parses an f64; out-of-range magnitudes saturate to ±inf or 0 as Rust's do.

func Int

func Int(s string, bits int) (int64, error)

Int parses a signed integer of the given bit size (i8..i64): an optional '+' or '-', then ASCII digits only.

func Uint

func Uint(s string, bits int) (uint64, error)

Uint parses an unsigned integer of the given bit size (u8..u64): an optional '+', then ASCII digits only; a '-' is an invalid digit.

Types

type Error

type Error string

Error is a ParseIntError / ParseFloatError: its message is Rust's.

const (
	ErrIntEmpty   Error = "cannot parse integer from empty string"
	ErrIntDigit   Error = "invalid digit found in string"
	ErrIntHigh    Error = "number too large to fit in target type"
	ErrIntLow     Error = "number too small to fit in target type"
	ErrFloatEmpty Error = "cannot parse float from empty string"
	ErrFloat      Error = "invalid float literal"
)

Rust's messages.

func (Error) Error

func (e Error) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL