diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2012-07-11 12:45:54 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2012-07-11 12:47:32 -0700 |
| commit | fdf0c1b353393ff34b1dee6edfbfece13f7c3093 (patch) | |
| tree | 8b2801f2f3ce11e49e56a0e7d131fc725d2ed3eb /src/libcore/dvec.rs | |
| parent | c0961bb88fe274795725c871871d7053429ae22e (diff) | |
core: Newtype a bunch of types in libcore
Diffstat (limited to 'src/libcore/dvec.rs')
| -rw-r--r-- | src/libcore/dvec.rs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/libcore/dvec.rs b/src/libcore/dvec.rs index ec396f474a7..f9bb58380b2 100644 --- a/src/libcore/dvec.rs +++ b/src/libcore/dvec.rs @@ -46,28 +46,32 @@ export unwrap; * pointers achieved about 103 million pushes/second. Using an option * type could only produce 47 million pushes/second. */ -type dvec<A> = { +type dvec_<A> = { mut data: ~[mut A] }; +enum dvec<A> { + dvec_(dvec_<A>) +} + /// Creates a new, empty dvec fn dvec<A>() -> dvec<A> { - {mut data: ~[mut]} + dvec_({mut data: ~[mut]}) } /// Creates a new dvec with a single element fn from_elem<A>(+e: A) -> dvec<A> { - {mut data: ~[mut e]} + dvec_({mut data: ~[mut e]}) } /// Creates a new dvec with the contents of a vector fn from_vec<A>(+v: ~[mut A]) -> dvec<A> { - {mut data: v} + dvec_({mut data: v}) } /// Consumes the vector and returns its contents fn unwrap<A>(-d: dvec<A>) -> ~[mut A] { - let {data: v} <- d; + let dvec_({data: v}) <- d; ret v; } |
