mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-31 10:22:15 +00:00
typetraits.arity: improve the documentation; fixes #8965
This commit is contained in:
@@ -35,8 +35,13 @@ proc `$`*(t: typedesc): string =
|
||||
## An alias for `name`.
|
||||
name(t)
|
||||
|
||||
proc arity*(t: typedesc): int {.magic: "TypeTrait".}
|
||||
## Returns the arity of the given type
|
||||
proc arity*(t: typedesc): int {.magic: "TypeTrait".} =
|
||||
## Returns the arity of the given type. This is the number of "type" components or
|
||||
## the number of generic parameters a given type ``t`` has.
|
||||
runnableExamples:
|
||||
assert arity(seq[string]) == 1
|
||||
assert arity(array[3, int]) == 2
|
||||
assert arity((int, int, float, string)) == 4
|
||||
|
||||
proc genericHead*(t: typedesc): typedesc {.magic: "TypeTrait".}
|
||||
## Accepts an instantiated generic type and returns its
|
||||
|
||||
Reference in New Issue
Block a user