diff options
Diffstat (limited to 'src/libstd/list.rs')
| -rw-r--r-- | src/libstd/list.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libstd/list.rs b/src/libstd/list.rs index 95fc53f49b4..665b2d38f8f 100644 --- a/src/libstd/list.rs +++ b/src/libstd/list.rs @@ -102,6 +102,11 @@ pure fn append<T: copy>(l: @list<T>, m: @list<T>) -> @list<T> { } } +#[doc = "Push an element to the front of a list"] +fn push<T: copy>(&l: list<T>, v: T) { + l = cons(v, @l); +} + #[doc = "Iterate over a list"] fn iter<T>(l: @list<T>, f: fn(T)) { let mut cur = l; |
