blob: 5b16b8becc690ee8326b736a1062738ad32a2894 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
## std.clone: Interfaces for explicitly Clonable types.
## This module is imported by default.
## The Clone interface. Any type implementing Clone is cloneable.
## Data structures built with pointers and references are pretty much
## the only things that are *not* implicitly clonable.
pub type Clone = interface
clone(lent Self): Self # todo
## Generic implementation of `clone` for structs.
pub func clone[T: struct](self: T): T =
...
## Generic implementation of `clone` for tuples.
pub func clone[T: tuple](self: T): T =
...
## Implementation of `clone` for arrays of any size.
pub func clone[T, S: static[uint]](self: array[T, S]): array[T, S] =
...
## Implementation of `clone` for lists.
pub func clone[T](self: list[T]): list[T] =
...
## Implementation of `clone` for strings.
pub func clone(self: str): str =
...
|