<commit_before>use core::cmp::{Eq, Ord};
use std::cmp::FuzzyEq;

use num::cast::NumCast;
use num::default_eq::DefaultEq;


pub trait Number: DefaultEq, Eq, Num, NumCast, Ord {
    static pure fn from<T:Number>(n: T) -> self;
    
    static pure fn zero() -> self;
    static pure fn one()  -> self;
}

pub impl u8: Number {
    #[inline(always)] static pure fn from<T:Number>(n: T) -> u8 { n.to_u8() }
    
    #[inline(always)] static pure fn zero() -> u8 { 0u8 }
    #[inline(always)] static pure fn one()  -> u8 { 1u8 }
}

pub impl u16: Number {
    #[inline(always)] static pure fn from<T:Number>(n: T) -> u16 { n.to_u16() }
    
    #[inline(always)] static pure fn zero() -> u16 { 0u16 }
    #[inline(always)] static pure fn one()  -> u16 { 1u16 }
}

pub impl u32: Number {
    #[inline(always)] static pure fn from<T:Number>(n: T) -> u32 { n.to_u32() }
    
    #[inline(always)] static pure fn zero() -> u32 { 0u32 }
    #[inline(always)] static pure fn one()  -> u32 { 1u32 }
}

pub impl u64: Number {
    #[inline(always)] static pure fn from<T:Number>(n: T) -> u64 { n.to_u64() }
    
    #[inline(always)] static pure fn zero() -> u64 { 0u64 }
    #[inline(always)] static pure fn one()  -> u64 { 1u64 }
}

pub impl uint: Number {
    #[inline(always)] static pure fn from<T:Number>(n: T) -> uint { n.to_uint() }
    
    #[inline(always)] static pure fn zero() -> uint { 0u }
    #[inline(always)] static pure fn one()  -> uint { 1u }
}

pub impl i8: Number {
    #[inline(always)] static pure fn from<T:Number>(n: T) -> i8 { n.to_i8() }
    
    #[inline(always)] static pure fn zero() -> i8 { 0i8 }
    #[inline(always)] static pure fn one()  -> i8 { 1i8 }
}

pub impl i16: Number {
    #[inline(always)] static pure fn from<T:Number>(n: T) -> i16 { n.to_i16() }
    
    #[inline(always)] static pure fn zero() -> i16 { 0i16 }
    #[inline(always)] static pure fn one()  -> i16 { 1i16 }
}

pub impl i32: Number {
    #[inline(always)] static pure fn from<T:Number>(n: T) -> i32 { n.to_i32() }
    
    #[inline(always)] static pure fn zero() -> i32 { 0i32 }
    #[inline(always)] static pure fn one()  -> i32 { 1i32 }
}

pub impl i64: Number {
    #[inline(always)] static pure fn from<T:Number>(n: T) -> i64 { n.to_i64() }
    
    #[inline(always)] static pure fn zero() -> i64 { 0i64 }
    #[inline(always)] static pure fn one()  -> i64 { 1i64 }
}

pub impl int: Number {
    #[inline(always)] static pure fn from<T:Number>(n: T) -> int { n.to_int() }
    
    #[inline(always)] static pure fn zero() -> int { 0 }
    #[inline(always)] static pure fn one()  -> int { 1 }
}

pub impl f32: Number {
    #[inline(always)] static pure fn from<T:Number>(n: T) -> f32 { n.to_f32() }
    
    #[inline(always)] static pure fn zero() -> f32 { 0f32 }
    #[inline(always)] static pure fn one()  -> f32 { 1f32 }
}

pub impl f64: Number {
    #[inline(always)] static pure fn from<T:Number>(n: T) -> f64 { n.to_f64() }
    
    #[inline(always)] static pure fn zero() -> f64 { 0f64 }
    #[inline(always)] static pure fn one()  -> f64 { 1f64 }
}

pub impl float: Number {
    #[inline(always)] static pure fn from<T:Number>(n: T) -> float { n.to_float() }
    
    #[inline(always)] static pure fn zero() -> float { 0f }
    #[inline(always)] static pure fn one()  -> float { 1f }
}


pub trait UnSigned: Number {}

pub impl u8:   UnSigned {}
pub impl u16:  UnSigned {}
pub impl u32:  UnSigned {}
pub impl u64:  UnSigned {}
pub impl uint: UnSigned {}


pub trait Signed: Number {}

pub impl i8:    Signed {}
pub impl i16:   Signed {}
pub impl i32:   Signed {}
pub impl i64:   Signed {}<commit_msg>Add documentation comments to Number trait and impls<commit_after>use core::cmp::{Eq, Ord};
use std::cmp::FuzzyEq;

use num::cast::NumCast;
use num::default_eq::DefaultEq;


pub trait Number: DefaultEq, Eq, Num, NumCast, Ord {
    /**
     * Construct a number from the type `T:Number`
     */
    static pure fn from<T:Number>(n: T) -> self;
    
    static pure fn zero() -> self;      /// The additive identity of the number
    static pure fn one()  -> self;      // The multiplicative identity of the number
}

pub impl u8: Number {
    /**
     * Construct a `u8` from the type `T:Number`
     */
    #[inline(always)] static pure fn from<T:Number>(n: T) -> u8 { n.to_u8() }
    
    #[inline(always)] static pure fn zero() -> u8 { 0u8 }       /// 0u8
    #[inline(always)] static pure fn one()  -> u8 { 1u8 }       //  1u8
}

pub impl u16: Number {
    /**
     * Construct a `u16` from the type `T:Number`
     */
    #[inline(always)] static pure fn from<T:Number>(n: T) -> u16 { n.to_u16() }
    
    #[inline(always)] static pure fn zero() -> u16 { 0u16 }     /// 0u16
    #[inline(always)] static pure fn one()  -> u16 { 1u16 }     //  1u16
}

pub impl u32: Number {
    /**
     * Construct a `u32` from the type `T:Number`
     */
    #[inline(always)] static pure fn from<T:Number>(n: T) -> u32 { n.to_u32() }
    
    #[inline(always)] static pure fn zero() -> u32 { 0u32 }     /// 0u32
    #[inline(always)] static pure fn one()  -> u32 { 1u32 }     //  1u32
}

pub impl u64: Number {
    /**
     * Construct a `u64` from the type `T:Number`
     */
    #[inline(always)] static pure fn from<T:Number>(n: T) -> u64 { n.to_u64() }
    
    #[inline(always)] static pure fn zero() -> u64 { 0u64 }     /// 0u64
    #[inline(always)] static pure fn one()  -> u64 { 1u64 }     //  1u64
}

pub impl uint: Number {
    /**
     * Construct a `uint` from the type `T:Number`
     */
    #[inline(always)] static pure fn from<T:Number>(n: T) -> uint { n.to_uint() }
    
    #[inline(always)] static pure fn zero() -> uint { 0u }      /// 0u
    #[inline(always)] static pure fn one()  -> uint { 1u }      //  1u
}

pub impl i8: Number {
    /**
     * Construct an `i8` from the type `T:Number`
     */
    #[inline(always)] static pure fn from<T:Number>(n: T) -> i8 { n.to_i8() }
    
    #[inline(always)] static pure fn zero() -> i8 { 0i8 }       /// 0i8
    #[inline(always)] static pure fn one()  -> i8 { 1i8 }       //  1i8
}

pub impl i16: Number {
    /**
     * Construct an `i16` from the type `T:Number`
     */
    #[inline(always)] static pure fn from<T:Number>(n: T) -> i16 { n.to_i16() }
    
    #[inline(always)] static pure fn zero() -> i16 { 0i16 }     /// 0i16
    #[inline(always)] static pure fn one()  -> i16 { 1i16 }     //  1i16
}

pub impl i32: Number {
    /**
     * Construct an `i32` from the type `T:Number`
     */
    #[inline(always)] static pure fn from<T:Number>(n: T) -> i32 { n.to_i32() }
    
    #[inline(always)] static pure fn zero() -> i32 { 0i32 }     /// 0i32
    #[inline(always)] static pure fn one()  -> i32 { 1i32 }     //  1i32
}

pub impl i64: Number {
    /**
     * Construct an `i64` from the type `T:Number`
     */
    #[inline(always)] static pure fn from<T:Number>(n: T) -> i64 { n.to_i64() }
    
    #[inline(always)] static pure fn zero() -> i64 { 0i64 }     /// 0i64
    #[inline(always)] static pure fn one()  -> i64 { 1i64 }     //  1i64
}

pub impl int: Number {
    /**
     * Construct an `int` from the type `T:Number`
     */
    #[inline(always)] static pure fn from<T:Number>(n: T) -> int { n.to_int() }
    
    #[inline(always)] static pure fn zero() -> int { 0 }        /// 0
    #[inline(always)] static pure fn one()  -> int { 1 }        //  1
}

pub impl f32: Number {
    /**
     * Construct a `f32` from the type `T:Number`
     */
    #[inline(always)] static pure fn from<T:Number>(n: T) -> f32 { n.to_f32() }
    
    #[inline(always)] static pure fn zero() -> f32 { 0f32 }     /// 0f32
    #[inline(always)] static pure fn one()  -> f32 { 1f32 }     //  1f32
}

pub impl f64: Number {
    /**
     * Construct a `f64` from the type `T:Number`
     */
    #[inline(always)] static pure fn from<T:Number>(n: T) -> f64 { n.to_f64() }
    
    #[inline(always)] static pure fn zero() -> f64 { 0f64 }     /// 0f64
    #[inline(always)] static pure fn one()  -> f64 { 1f64 }     //  1f64
}

pub impl float: Number {
    /**
     * Construct a `float` from the type `T:Number`
     */
    #[inline(always)] static pure fn from<T:Number>(n: T) -> float { n.to_float() }
    
    #[inline(always)] static pure fn zero() -> float { 0f }     /// 0f
    #[inline(always)] static pure fn one()  -> float { 1f }     //  1f
}


pub trait UnSigned: Number {}

pub impl u8:   UnSigned {}
pub impl u16:  UnSigned {}
pub impl u32:  UnSigned {}
pub impl u64:  UnSigned {}
pub impl uint: UnSigned {}


pub trait Signed: Number {}

pub impl i8:    Signed {}
pub impl i16:   Signed {}
pub impl i32:   Signed {}
pub impl i64:   Signed {}
{'fraction_non_alphanumeric': 0.17531638221293394, 'fraction_numerical': 0.0478346685243237, 'mean_word_length': 2.469190495368506, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 115, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7414250', 'n_tokens_mistral': 3336, 'n_tokens_neox': 3191, 'n_words': 973}