Add no_std and fix tests
This commit is contained in:
parent
00aabcfe32
commit
5bbfb9187d
|
@ -2,7 +2,7 @@
|
||||||
name = "integer-sqrt"
|
name = "integer-sqrt"
|
||||||
description = """
|
description = """
|
||||||
An implementation of integer square root algorithm for primitive rust types"""
|
An implementation of integer square root algorithm for primitive rust types"""
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
authors = ["Richard Dodd <richard.dodd@itp-group.co.uk>"]
|
authors = ["Richard Dodd <richard.dodd@itp-group.co.uk>"]
|
||||||
include = ["src/**/*.rs", "Cargo.toml"]
|
include = ["src/**/*.rs", "Cargo.toml"]
|
||||||
repository = "https://github.com/derekdreery/integer-sqrt-rs"
|
repository = "https://github.com/derekdreery/integer-sqrt-rs"
|
||||||
|
|
|
@ -11,9 +11,11 @@
|
||||||
//!
|
//!
|
||||||
//! # fn main() {
|
//! # fn main() {
|
||||||
//! assert_eq!(4u8.integer_sqrt(), 2);
|
//! assert_eq!(4u8.integer_sqrt(), 2);
|
||||||
|
//! # }
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! [`IntegerSquareRoot`]: ./trait.IntegerSquareRoot.html
|
//! [`IntegerSquareRoot`]: ./trait.IntegerSquareRoot.html
|
||||||
|
#![no_std]
|
||||||
|
|
||||||
/// A trait implementing integer square root.
|
/// A trait implementing integer square root.
|
||||||
pub trait IntegerSquareRoot {
|
pub trait IntegerSquareRoot {
|
||||||
|
@ -88,7 +90,7 @@ impl_isqrt!(usize, u64, u32, u16, u8, isize, i64, i32, i16, i8);
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::IntegerSquareRoot;
|
use super::IntegerSquareRoot;
|
||||||
use std::{u8, u16, u64, i8};
|
use core::{u8, u16, u64, i8};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn u8_sqrt() {
|
fn u8_sqrt() {
|
||||||
|
|
Loading…
Reference in New Issue