Change some uses of static methods to use the trait path
This commit is contained in:
parent
732c39c183
commit
e7ef82dd70
5 changed files with 10 additions and 11 deletions
|
@ -36,7 +36,7 @@ pub use f64::{modf, pow, round, sinh, tanh, tgamma, trunc};
|
||||||
pub use f64::signbit;
|
pub use f64::signbit;
|
||||||
pub use f64::{j0, j1, jn, y0, y1, yn};
|
pub use f64::{j0, j1, jn, y0, y1, yn};
|
||||||
use cmp::{Eq, Ord};
|
use cmp::{Eq, Ord};
|
||||||
use num::from_int;
|
use num::Num::from_int;
|
||||||
|
|
||||||
pub const NaN: float = 0.0/0.0;
|
pub const NaN: float = 0.0/0.0;
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ use T = self::inst::T;
|
||||||
|
|
||||||
use cmp::{Eq, Ord};
|
use cmp::{Eq, Ord};
|
||||||
use from_str::FromStr;
|
use from_str::FromStr;
|
||||||
use num::from_int;
|
use num::Num::from_int;
|
||||||
|
|
||||||
pub const bits : uint = inst::bits;
|
pub const bits : uint = inst::bits;
|
||||||
pub const bytes : uint = (inst::bits / 8);
|
pub const bytes : uint = (inst::bits / 8);
|
||||||
|
|
|
@ -244,7 +244,7 @@ pub pure fn find<A: Copy,IA:BaseIter<A>>(self: &IA,
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub pure fn build<A,B: Buildable<A>>(builder: fn(push: pure fn(v: A)))
|
pub pure fn build<A,B: Buildable<A>>(builder: fn(push: pure fn(v: A)))
|
||||||
-> B {
|
-> B {
|
||||||
build_sized(4, builder)
|
Buildable::build_sized(4, builder)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -265,7 +265,7 @@ pub pure fn build_sized_opt<A,B: Buildable<A>>(
|
||||||
size: Option<uint>,
|
size: Option<uint>,
|
||||||
builder: fn(push: pure fn(v: A))) -> B {
|
builder: fn(push: pure fn(v: A))) -> B {
|
||||||
|
|
||||||
build_sized(size.get_default(4), builder)
|
Buildable::build_sized(size.get_default(4), builder)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Functions that combine iteration and building
|
// Functions that combine iteration and building
|
||||||
|
@ -288,7 +288,7 @@ pub fn map<T,IT: BaseIter<T>,U,BU: Buildable<U>>(v: &IT, f: fn(&T) -> U)
|
||||||
*/
|
*/
|
||||||
pub pure fn from_fn<T,BT: Buildable<T>>(n_elts: uint,
|
pub pure fn from_fn<T,BT: Buildable<T>>(n_elts: uint,
|
||||||
op: InitOp<T>) -> BT {
|
op: InitOp<T>) -> BT {
|
||||||
do build_sized(n_elts) |push| {
|
do Buildable::build_sized(n_elts) |push| {
|
||||||
let mut i: uint = 0u;
|
let mut i: uint = 0u;
|
||||||
while i < n_elts { push(op(i)); i += 1u; }
|
while i < n_elts { push(op(i)); i += 1u; }
|
||||||
}
|
}
|
||||||
|
@ -302,7 +302,7 @@ pub pure fn from_fn<T,BT: Buildable<T>>(n_elts: uint,
|
||||||
*/
|
*/
|
||||||
pub pure fn from_elem<T: Copy,BT: Buildable<T>>(n_elts: uint,
|
pub pure fn from_elem<T: Copy,BT: Buildable<T>>(n_elts: uint,
|
||||||
t: T) -> BT {
|
t: T) -> BT {
|
||||||
do build_sized(n_elts) |push| {
|
do Buildable::build_sized(n_elts) |push| {
|
||||||
let mut i: uint = 0;
|
let mut i: uint = 0;
|
||||||
while i < n_elts { push(t); i += 1; }
|
while i < n_elts { push(t); i += 1; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ pub struct WindowsPath {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub pure fn WindowsPath(s: &str) -> WindowsPath {
|
pub pure fn WindowsPath(s: &str) -> WindowsPath {
|
||||||
from_str(s)
|
GenericPath::from_str(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving_eq]
|
#[deriving_eq]
|
||||||
|
@ -39,7 +39,7 @@ pub struct PosixPath {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub pure fn PosixPath(s: &str) -> PosixPath {
|
pub pure fn PosixPath(s: &str) -> PosixPath {
|
||||||
from_str(s)
|
GenericPath::from_str(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait GenericPath {
|
pub trait GenericPath {
|
||||||
|
|
|
@ -16,8 +16,7 @@ use either::{Right,Left,Either};
|
||||||
use json;
|
use json;
|
||||||
use sha1;
|
use sha1;
|
||||||
use serialization::{Serializer,Serializable,
|
use serialization::{Serializer,Serializable,
|
||||||
Deserializer,Deserializable,
|
Deserializer,Deserializable};
|
||||||
deserialize};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -261,7 +260,7 @@ impl Prep {
|
||||||
|
|
||||||
let v : T = do io::with_str_reader(res) |rdr| {
|
let v : T = do io::with_str_reader(res) |rdr| {
|
||||||
let j = result::unwrap(json::from_reader(rdr));
|
let j = result::unwrap(json::from_reader(rdr));
|
||||||
deserialize(&json::Deserializer(move j))
|
Deserializable::deserialize(&json::Deserializer(move j))
|
||||||
};
|
};
|
||||||
return Work::new(self, move Left(move v));
|
return Work::new(self, move Left(move v));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue