Camel case core::ops
This commit is contained in:
parent
cb0eb66672
commit
f393100b7c
|
@ -133,7 +133,7 @@ pure fn from_elem<T: copy>(n_elts: uint, t: T) -> @[T] {
|
|||
}
|
||||
|
||||
#[cfg(notest)]
|
||||
impl<T: copy> @[T]: add<&[const T],@[T]> {
|
||||
impl<T: copy> @[T]: Add<&[const T],@[T]> {
|
||||
#[inline(always)]
|
||||
pure fn add(rhs: &[const T]) -> @[T] {
|
||||
append(self, rhs)
|
||||
|
|
|
@ -44,28 +44,28 @@ export ToStr;
|
|||
// The compiler has special knowlege of these so we must not duplicate them
|
||||
// when compiling for testing
|
||||
#[cfg(notest)]
|
||||
import ops::{const, copy, send, owned};
|
||||
import ops::{Const, Copy, Send, Owned};
|
||||
#[cfg(notest)]
|
||||
import ops::{add, sub, mul, div, modulo, neg, bitand, bitor, bitxor};
|
||||
import ops::{Add, Sub, Mul, Div, Modulo, Neg, BitAnd, BitOr, BitXor};
|
||||
#[cfg(notest)]
|
||||
import ops::{shl, shr, index};
|
||||
import ops::{Shl, Shr, Index};
|
||||
|
||||
#[cfg(notest)]
|
||||
export const, copy, send, owned;
|
||||
export Const, Copy, Send, Owned;
|
||||
#[cfg(notest)]
|
||||
export add, sub, mul, div, modulo, neg, bitand, bitor, bitxor;
|
||||
export Add, Sub, Mul, Div, Modulo, Neg, BitAnd, BitOr, BitXor;
|
||||
#[cfg(notest)]
|
||||
export shl, shr, index;
|
||||
export Shl, Shr, Index;
|
||||
|
||||
#[cfg(test)]
|
||||
use coreops(name = "core", vers = "0.4");
|
||||
|
||||
#[cfg(test)]
|
||||
import coreops::ops::{const, copy, send, owned};
|
||||
import coreops::ops::{Const, Copy, Send, Owned};
|
||||
#[cfg(test)]
|
||||
import coreops::ops::{add, sub, mul, div, modulo, neg, bitand, bitor, bitxor};
|
||||
import coreops::ops::{Add, Sub, Mul, Div, Modulo, Neg, BitAnd, BitOr, BitXor};
|
||||
#[cfg(test)]
|
||||
import coreops::ops::{shl, shr, index};
|
||||
import coreops::ops::{Shl, Shr, Index};
|
||||
|
||||
|
||||
// Export the log levels as global constants. Higher levels mean
|
||||
|
|
|
@ -327,7 +327,7 @@ impl<A: copy> DVec<A> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<A:copy> DVec<A>: index<uint,A> {
|
||||
impl<A:copy> DVec<A>: Index<uint,A> {
|
||||
pure fn index(&&idx: uint) -> A {
|
||||
self.get_elt(idx)
|
||||
}
|
||||
|
|
|
@ -1,100 +1,98 @@
|
|||
// Core operators and kinds.
|
||||
|
||||
#[allow(non_camel_case_types)];
|
||||
|
||||
#[cfg(notest)]
|
||||
#[lang="const"]
|
||||
trait const {
|
||||
trait Const {
|
||||
// Empty.
|
||||
}
|
||||
|
||||
#[cfg(notest)]
|
||||
#[lang="copy"]
|
||||
trait copy {
|
||||
trait Copy {
|
||||
// Empty.
|
||||
}
|
||||
|
||||
#[cfg(notest)]
|
||||
#[lang="send"]
|
||||
trait send {
|
||||
trait Send {
|
||||
// Empty.
|
||||
}
|
||||
|
||||
#[cfg(notest)]
|
||||
#[lang="owned"]
|
||||
trait owned {
|
||||
trait Owned {
|
||||
// Empty.
|
||||
}
|
||||
|
||||
#[cfg(notest)]
|
||||
#[lang="add"]
|
||||
trait add<RHS,Result> {
|
||||
trait Add<RHS,Result> {
|
||||
pure fn add(rhs: RHS) -> Result;
|
||||
}
|
||||
|
||||
#[cfg(notest)]
|
||||
#[lang="sub"]
|
||||
trait sub<RHS,Result> {
|
||||
trait Sub<RHS,Result> {
|
||||
pure fn sub(rhs: RHS) -> Result;
|
||||
}
|
||||
|
||||
#[cfg(notest)]
|
||||
#[lang="mul"]
|
||||
trait mul<RHS,Result> {
|
||||
trait Mul<RHS,Result> {
|
||||
pure fn mul(rhs: RHS) -> Result;
|
||||
}
|
||||
|
||||
#[cfg(notest)]
|
||||
#[lang="div"]
|
||||
trait div<RHS,Result> {
|
||||
trait Div<RHS,Result> {
|
||||
pure fn div(rhs: RHS) -> Result;
|
||||
}
|
||||
|
||||
#[cfg(notest)]
|
||||
#[lang="modulo"]
|
||||
trait modulo<RHS,Result> {
|
||||
trait Modulo<RHS,Result> {
|
||||
pure fn modulo(rhs: RHS) -> Result;
|
||||
}
|
||||
|
||||
#[cfg(notest)]
|
||||
#[lang="neg"]
|
||||
trait neg<Result> {
|
||||
trait Neg<Result> {
|
||||
pure fn neg() -> Result;
|
||||
}
|
||||
|
||||
#[cfg(notest)]
|
||||
#[lang="bitand"]
|
||||
trait bitand<RHS,Result> {
|
||||
trait BitAnd<RHS,Result> {
|
||||
pure fn bitand(rhs: RHS) -> Result;
|
||||
}
|
||||
|
||||
#[cfg(notest)]
|
||||
#[lang="bitor"]
|
||||
trait bitor<RHS,Result> {
|
||||
trait BitOr<RHS,Result> {
|
||||
pure fn bitor(rhs: RHS) -> Result;
|
||||
}
|
||||
|
||||
#[cfg(notest)]
|
||||
#[lang="bitxor"]
|
||||
trait bitxor<RHS,Result> {
|
||||
trait BitXor<RHS,Result> {
|
||||
pure fn bitxor(rhs: RHS) -> Result;
|
||||
}
|
||||
|
||||
#[cfg(notest)]
|
||||
#[lang="shl"]
|
||||
trait shl<RHS,Result> {
|
||||
trait Shl<RHS,Result> {
|
||||
pure fn shl(rhs: RHS) -> Result;
|
||||
}
|
||||
|
||||
#[cfg(notest)]
|
||||
#[lang="shr"]
|
||||
trait shr<RHS,Result> {
|
||||
trait Shr<RHS,Result> {
|
||||
pure fn shr(rhs: RHS) -> Result;
|
||||
}
|
||||
|
||||
#[cfg(notest)]
|
||||
#[lang="index"]
|
||||
trait index<Index,Result> {
|
||||
trait Index<Index,Result> {
|
||||
pure fn index(index: Index) -> Result;
|
||||
}
|
||||
|
||||
|
|
|
@ -2065,7 +2065,7 @@ impl ~str: UniqueStr {
|
|||
}
|
||||
|
||||
#[cfg(notest)]
|
||||
impl ~str: add<&str,~str> {
|
||||
impl ~str: Add<&str,~str> {
|
||||
#[inline(always)]
|
||||
pure fn add(rhs: &str) -> ~str {
|
||||
append(copy self, rhs)
|
||||
|
|
|
@ -1480,14 +1480,14 @@ impl<T: Ord> @[T]: Ord {
|
|||
}
|
||||
|
||||
#[cfg(notest)]
|
||||
impl<T: copy> ~[T]: add<&[const T],~[T]> {
|
||||
impl<T: copy> ~[T]: Add<&[const T],~[T]> {
|
||||
#[inline(always)]
|
||||
pure fn add(rhs: &[const T]) -> ~[T] {
|
||||
append(copy self, rhs)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: copy> ~[mut T]: add<&[const T],~[mut T]> {
|
||||
impl<T: copy> ~[mut T]: Add<&[const T],~[mut T]> {
|
||||
#[inline(always)]
|
||||
pure fn add(rhs: &[const T]) -> ~[mut T] {
|
||||
append_mut(self, rhs)
|
||||
|
|
|
@ -469,7 +469,7 @@ pure fn land(w0: uint, w1: uint) -> uint { return w0 & w1; }
|
|||
|
||||
pure fn right(_w0: uint, w1: uint) -> uint { return w1; }
|
||||
|
||||
impl Bitv: ops::index<uint,bool> {
|
||||
impl Bitv: ops::Index<uint,bool> {
|
||||
pure fn index(&&i: uint) -> bool {
|
||||
self.get(i)
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ type Doc = {data: @~[u8], start: uint, end: uint};
|
|||
|
||||
type TaggedDoc = {tag: uint, doc: Doc};
|
||||
|
||||
impl Doc: ops::index<uint,Doc> {
|
||||
impl Doc: ops::Index<uint,Doc> {
|
||||
pure fn index(&&tag: uint) -> Doc {
|
||||
unchecked {
|
||||
get_doc(self, tag)
|
||||
|
|
|
@ -367,7 +367,7 @@ mod chained {
|
|||
}
|
||||
}
|
||||
|
||||
impl<K: copy, V: copy> t<K, V>: ops::index<K, V> {
|
||||
impl<K: copy, V: copy> t<K, V>: ops::Index<K, V> {
|
||||
pure fn index(&&k: K) -> V {
|
||||
unchecked {
|
||||
self.get(k)
|
||||
|
|
|
@ -134,7 +134,7 @@ impl<V: copy> smallintmap<V>: map::map<uint, V> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<V: copy> smallintmap<V>: ops::index<uint, V> {
|
||||
impl<V: copy> smallintmap<V>: ops::Index<uint, V> {
|
||||
pure fn index(&&key: uint) -> V {
|
||||
unchecked {
|
||||
get(self, key)
|
||||
|
|
|
@ -1605,7 +1605,7 @@ fn remove_copyable(k: kind) -> kind {
|
|||
k - kind_(KIND_MASK_COPY | KIND_MASK_DEFAULT_MODE)
|
||||
}
|
||||
|
||||
impl kind: ops::bitand<kind,kind> {
|
||||
impl kind: ops::BitAnd<kind,kind> {
|
||||
pure fn bitand(other: kind) -> kind {
|
||||
unchecked {
|
||||
lower_kind(self, other)
|
||||
|
@ -1613,7 +1613,7 @@ impl kind: ops::bitand<kind,kind> {
|
|||
}
|
||||
}
|
||||
|
||||
impl kind: ops::bitor<kind,kind> {
|
||||
impl kind: ops::BitOr<kind,kind> {
|
||||
pure fn bitor(other: kind) -> kind {
|
||||
unchecked {
|
||||
raise_kind(self, other)
|
||||
|
@ -1621,7 +1621,7 @@ impl kind: ops::bitor<kind,kind> {
|
|||
}
|
||||
}
|
||||
|
||||
impl kind: ops::sub<kind,kind> {
|
||||
impl kind: ops::Sub<kind,kind> {
|
||||
pure fn sub(other: kind) -> kind {
|
||||
unchecked {
|
||||
kind_(*self & !*other)
|
||||
|
|
|
@ -21,7 +21,7 @@ struct cmplx {
|
|||
im: f64;
|
||||
}
|
||||
|
||||
impl cmplx : ops::mul<cmplx,cmplx> {
|
||||
impl cmplx : ops::Mul<cmplx,cmplx> {
|
||||
pure fn mul(x: cmplx) -> cmplx {
|
||||
cmplx {
|
||||
re: self.re*x.re - self.im*x.im,
|
||||
|
@ -30,7 +30,7 @@ impl cmplx : ops::mul<cmplx,cmplx> {
|
|||
}
|
||||
}
|
||||
|
||||
impl cmplx : ops::add<cmplx,cmplx> {
|
||||
impl cmplx : ops::Add<cmplx,cmplx> {
|
||||
pure fn add(x: cmplx) -> cmplx {
|
||||
cmplx {
|
||||
re: self.re + x.re,
|
||||
|
|
|
@ -3,7 +3,7 @@ struct Point {
|
|||
y: int;
|
||||
}
|
||||
|
||||
impl Point : ops::add<int,int> {
|
||||
impl Point : ops::Add<int,int> {
|
||||
pure fn add(&&z: int) -> int {
|
||||
self.x + self.y + z
|
||||
}
|
||||
|
|
|
@ -3,25 +3,25 @@ struct Point {
|
|||
y: int;
|
||||
}
|
||||
|
||||
impl Point : ops::add<Point,Point> {
|
||||
impl Point : ops::Add<Point,Point> {
|
||||
pure fn add(other: Point) -> Point {
|
||||
Point {x: self.x + other.x, y: self.y + other.y}
|
||||
}
|
||||
}
|
||||
|
||||
impl Point : ops::sub<Point,Point> {
|
||||
impl Point : ops::Sub<Point,Point> {
|
||||
pure fn sub(other: Point) -> Point {
|
||||
Point {x: self.x - other.x, y: self.y - other.y}
|
||||
}
|
||||
}
|
||||
|
||||
impl Point : ops::neg<Point> {
|
||||
impl Point : ops::Neg<Point> {
|
||||
pure fn neg() -> Point {
|
||||
Point {x: -self.x, y: -self.y}
|
||||
}
|
||||
}
|
||||
|
||||
impl Point : ops::index<bool,int> {
|
||||
impl Point : ops::Index<bool,int> {
|
||||
pure fn index(&&x: bool) -> int {
|
||||
if x { self.x } else { self.y }
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue