#![crate_name="static_methods_crate"]
#![crate_type = "lib"]
-use std::int;
-
pub trait read {
fn readMaybe(s: String) -> Option<Self>;
}
-impl read for int {
- fn readMaybe(s: String) -> Option<int> {
+impl read for isize {
+ fn readMaybe(s: String) -> Option<isize> {
s.parse().ok()
}
}
// except according to those terms.
use std::num::FromPrimitive;
-use std::int;
+use std::isize;
#[derive(PartialEq, FromPrimitive, Debug)]
enum A {
- Foo = int::MAX,
+ Foo = isize::MAX,
Bar = 1,
Baz = 3,
Qux,
}
pub fn main() {
- let x: Option<A> = FromPrimitive::from_int(int::MAX);
+ let x: Option<A> = FromPrimitive::from_int(isize::MAX);
assert_eq!(x, Some(A::Foo));
let x: Option<A> = FromPrimitive::from_int(1);
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::uint;
-
pub fn main() {
// sometimes we have had trouble finding
// the right type for f, as we unified
// bot and u32 here
- let f = match "1234".parse::<uint>().ok() {
+ let f = match "1234".parse::<usize>().ok() {
None => return (),
Some(num) => num as u32
};