[][src]Trait bstr_parse::FromBStrRadix

pub trait FromBStrRadix: Sized {
    pub fn from_bstr_radix(
        src: &[u8],
        radix: u32
    ) -> Result<Self, ParseIntError>; }

An extension trait for from_bstr_radix.

Required methods

pub fn from_bstr_radix(src: &[u8], radix: u32) -> Result<Self, ParseIntError>[src]

Converts a string slice in a given base to an integer.

The string is expected to be an optional + or - sign followed by digits. Leading and trailing whitespace represent an error. Digits are a subset of these characters, depending on radix:

  • 0-9
  • a-z
  • A-Z

Panics

This function panics if radix is not in the range from 2 to 36.

Examples

Basic usage:

use bstr_parse::*;

assert_eq!(u8::from_bstr_radix(b"A", 16), Ok(10));
Loading content...

Implementations on Foreign Types

impl FromBStrRadix for i8[src]

pub fn from_bstr_radix(src: &[u8], radix: u32) -> Result<Self, ParseIntError>[src]

Converts a string slice in a given base to an integer.

The string is expected to be an optional + or - sign followed by digits. Leading and trailing whitespace represent an error. Digits are a subset of these characters, depending on radix:

  • 0-9
  • a-z
  • A-Z

Panics

This function panics if radix is not in the range from 2 to 36.

Examples

Basic usage:

use bstr_parse::*;

assert_eq!(i8::from_bstr_radix(b"A", 16), Ok(10));

impl FromBStrRadix for i16[src]

pub fn from_bstr_radix(src: &[u8], radix: u32) -> Result<Self, ParseIntError>[src]

Converts a string slice in a given base to an integer.

The string is expected to be an optional + or - sign followed by digits. Leading and trailing whitespace represent an error. Digits are a subset of these characters, depending on radix:

  • 0-9
  • a-z
  • A-Z

Panics

This function panics if radix is not in the range from 2 to 36.

Examples

Basic usage:

use bstr_parse::*;

assert_eq!(i16::from_bstr_radix(b"A", 16), Ok(10));

impl FromBStrRadix for i32[src]

pub fn from_bstr_radix(src: &[u8], radix: u32) -> Result<Self, ParseIntError>[src]

Converts a string slice in a given base to an integer.

The string is expected to be an optional + or - sign followed by digits. Leading and trailing whitespace represent an error. Digits are a subset of these characters, depending on radix:

  • 0-9
  • a-z
  • A-Z

Panics

This function panics if radix is not in the range from 2 to 36.

Examples

Basic usage:

use bstr_parse::*;

assert_eq!(i32::from_bstr_radix(b"A", 16), Ok(10));

impl FromBStrRadix for i64[src]

pub fn from_bstr_radix(src: &[u8], radix: u32) -> Result<Self, ParseIntError>[src]

Converts a string slice in a given base to an integer.

The string is expected to be an optional + or - sign followed by digits. Leading and trailing whitespace represent an error. Digits are a subset of these characters, depending on radix:

  • 0-9
  • a-z
  • A-Z

Panics

This function panics if radix is not in the range from 2 to 36.

Examples

Basic usage:

use bstr_parse::*;

assert_eq!(i64::from_bstr_radix(b"A", 16), Ok(10));

impl FromBStrRadix for i128[src]

pub fn from_bstr_radix(src: &[u8], radix: u32) -> Result<Self, ParseIntError>[src]

Converts a string slice in a given base to an integer.

The string is expected to be an optional + or - sign followed by digits. Leading and trailing whitespace represent an error. Digits are a subset of these characters, depending on radix:

  • 0-9
  • a-z
  • A-Z

Panics

This function panics if radix is not in the range from 2 to 36.

Examples

Basic usage:

use bstr_parse::*;

assert_eq!(i128::from_bstr_radix(b"A", 16), Ok(10));

impl FromBStrRadix for isize[src]

pub fn from_bstr_radix(src: &[u8], radix: u32) -> Result<Self, ParseIntError>[src]

Converts a string slice in a given base to an integer.

The string is expected to be an optional + or - sign followed by digits. Leading and trailing whitespace represent an error. Digits are a subset of these characters, depending on radix:

  • 0-9
  • a-z
  • A-Z

Panics

This function panics if radix is not in the range from 2 to 36.

Examples

Basic usage:

use bstr_parse::*;

assert_eq!(isize::from_bstr_radix(b"A", 16), Ok(10));

impl FromBStrRadix for u8[src]

pub fn from_bstr_radix(src: &[u8], radix: u32) -> Result<Self, ParseIntError>[src]

Converts a string slice in a given base to an integer.

The string is expected to be an optional + or - sign followed by digits. Leading and trailing whitespace represent an error. Digits are a subset of these characters, depending on radix:

  • 0-9
  • a-z
  • A-Z

Panics

This function panics if radix is not in the range from 2 to 36.

Examples

Basic usage:

use bstr_parse::*;

assert_eq!(u8::from_bstr_radix(b"A", 16), Ok(10));

impl FromBStrRadix for u16[src]

pub fn from_bstr_radix(src: &[u8], radix: u32) -> Result<Self, ParseIntError>[src]

Converts a string slice in a given base to an integer.

The string is expected to be an optional + or - sign followed by digits. Leading and trailing whitespace represent an error. Digits are a subset of these characters, depending on radix:

  • 0-9
  • a-z
  • A-Z

Panics

This function panics if radix is not in the range from 2 to 36.

Examples

Basic usage:

use bstr_parse::*;

assert_eq!(u16::from_bstr_radix(b"A", 16), Ok(10));

impl FromBStrRadix for u32[src]

pub fn from_bstr_radix(src: &[u8], radix: u32) -> Result<Self, ParseIntError>[src]

Converts a string slice in a given base to an integer.

The string is expected to be an optional + or - sign followed by digits. Leading and trailing whitespace represent an error. Digits are a subset of these characters, depending on radix:

  • 0-9
  • a-z
  • A-Z

Panics

This function panics if radix is not in the range from 2 to 36.

Examples

Basic usage:

use bstr_parse::*;

assert_eq!(u32::from_bstr_radix(b"A", 16), Ok(10));

impl FromBStrRadix for u64[src]

pub fn from_bstr_radix(src: &[u8], radix: u32) -> Result<Self, ParseIntError>[src]

Converts a string slice in a given base to an integer.

The string is expected to be an optional + or - sign followed by digits. Leading and trailing whitespace represent an error. Digits are a subset of these characters, depending on radix:

  • 0-9
  • a-z
  • A-Z

Panics

This function panics if radix is not in the range from 2 to 36.

Examples

Basic usage:

use bstr_parse::*;

assert_eq!(u64::from_bstr_radix(b"A", 16), Ok(10));

impl FromBStrRadix for u128[src]

pub fn from_bstr_radix(src: &[u8], radix: u32) -> Result<Self, ParseIntError>[src]

Converts a string slice in a given base to an integer.

The string is expected to be an optional + or - sign followed by digits. Leading and trailing whitespace represent an error. Digits are a subset of these characters, depending on radix:

  • 0-9
  • a-z
  • A-Z

Panics

This function panics if radix is not in the range from 2 to 36.

Examples

Basic usage:

use bstr_parse::*;

assert_eq!(u128::from_bstr_radix(b"A", 16), Ok(10));

impl FromBStrRadix for usize[src]

pub fn from_bstr_radix(src: &[u8], radix: u32) -> Result<Self, ParseIntError>[src]

Converts a string slice in a given base to an integer.

The string is expected to be an optional + or - sign followed by digits. Leading and trailing whitespace represent an error. Digits are a subset of these characters, depending on radix:

  • 0-9
  • a-z
  • A-Z

Panics

This function panics if radix is not in the range from 2 to 36.

Examples

Basic usage:

use bstr_parse::*;

assert_eq!(usize::from_bstr_radix(b"A", 16), Ok(10));
Loading content...

Implementors

Loading content...