core: Docs
This commit is contained in:
parent
07d0981bbb
commit
389f53c6ff
5 changed files with 71 additions and 12 deletions
|
@ -1,13 +1,18 @@
|
|||
#[doc = "Operations on tuples"];
|
||||
|
||||
#[doc = "Return the first element of a pair"]
|
||||
pure fn first<T:copy, U:copy>(pair: (T, U)) -> T {
|
||||
let (t, _) = pair;
|
||||
ret t;
|
||||
}
|
||||
|
||||
#[doc = "Return the second element of a pair"]
|
||||
pure fn second<T:copy, U:copy>(pair: (T, U)) -> U {
|
||||
let (_, u) = pair;
|
||||
ret u;
|
||||
}
|
||||
|
||||
#[doc = "Return the results of swapping the two elements of a pair"]
|
||||
pure fn swap<T:copy, U:copy>(pair: (T, U)) -> (U, T) {
|
||||
let (t, u) = pair;
|
||||
ret (u, t);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue