Skip to content

Commit

Permalink
Example update
Browse files Browse the repository at this point in the history
  • Loading branch information
RoDmitry committed Dec 31, 2023
1 parent 7bb2f47 commit 440403a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ Got the idea from [here](https://rust-malaysia.github.io/code/2020/07/11/faster-
let val: u64 = atoi_simd::parse(b"1234").unwrap();
assert_eq!(val, 1234_u64);
assert_eq!(atoi_simd::parse::<i64>(b"-2345").unwrap(), -2345_i64);
assert_eq!(atoi_simd::parse::<i64>(b"-2345"), Ok(-2345_i64));
assert_eq!(atoi_simd::parse_until_invalid::<u64>(b"123something_else").unwrap(), (123_u64, 3));
assert_eq!(atoi_simd::parse_until_invalid::<u64>(b"123something_else"), Ok((123_u64, 3)));
// a drop-in replacement for `str::parse`
assert_eq!(atoi_simd::parse_skipped::<u64>(b"+000000000000000000001234").unwrap(), 1234_u64);
assert_eq!(atoi_simd::parse_skipped::<u64>(b"+000000000000000000001234"), Ok(1234_u64));
```

## Benchmarks
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
//! let val: u64 = atoi_simd::parse(b"1234").unwrap();
//! assert_eq!(val, 1234_u64);
//!
//! assert_eq!(atoi_simd::parse::<i64>(b"-2345").unwrap(), -2345_i64);
//! assert_eq!(atoi_simd::parse::<i64>(b"-2345"), Ok(-2345_i64));
//!
//! assert_eq!(atoi_simd::parse_until_invalid::<u64>(b"123something_else").unwrap(), (123_u64, 3));
//! assert_eq!(atoi_simd::parse_until_invalid::<u64>(b"123something_else"), Ok((123_u64, 3)));
//!
//! // a drop-in replacement for `str::parse`
//! assert_eq!(atoi_simd::parse_skipped::<u64>(b"+000000000000000000001234").unwrap(), 1234_u64);
//! assert_eq!(atoi_simd::parse_skipped::<u64>(b"+000000000000000000001234"), Ok(1234_u64));
//! ```
#![allow(clippy::comparison_chain)]
#![cfg_attr(not(feature = "std"), no_std)]
Expand Down

0 comments on commit 440403a

Please sign in to comment.