-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
99 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<!-- Code generated by gomarkdoc. DO NOT EDIT --> | ||
|
||
# generics | ||
|
||
```go | ||
import "github.com/princjef/gomarkdoc/testData/generics" | ||
``` | ||
|
||
## Index | ||
|
||
- [func Func\[S int | float64\]\(s S\) S](<#Func>) | ||
- [type Generic](<#Generic>) | ||
- [func NewGeneric\[T any\]\(param T\) Generic\[T\]](<#NewGeneric>) | ||
- [func \(g Generic\[T\]\) Method\(\)](<#Generic[T].Method>) | ||
|
||
|
||
<a name="Func"></a> | ||
## func [Func](<https://github.com/princjef/gomarkdoc/blob/master/testData/generics/generics.go#L17>) | ||
|
||
```go | ||
func Func[S int | float64](s S) S | ||
``` | ||
|
||
Func is a generic function. | ||
|
||
<a name="Generic"></a> | ||
## type [Generic](<https://github.com/princjef/gomarkdoc/blob/master/testData/generics/generics.go#L4-L6>) | ||
|
||
Generic is a generic struct. | ||
|
||
```go | ||
type Generic[T any] struct { | ||
Field T | ||
} | ||
``` | ||
|
||
<a name="NewGeneric"></a> | ||
### func [NewGeneric](<https://github.com/princjef/gomarkdoc/blob/master/testData/generics/generics.go#L9>) | ||
|
||
```go | ||
func NewGeneric[T any](param T) Generic[T] | ||
``` | ||
|
||
NewGeneric produces a new [Generic](<#Generic>) struct. | ||
|
||
<a name="Generic[T].Method"></a> | ||
### func \(Generic\[T\]\) [Method](<https://github.com/princjef/gomarkdoc/blob/master/testData/generics/generics.go#L14>) | ||
|
||
```go | ||
func (g Generic[T]) Method() | ||
``` | ||
|
||
Method is a method of a generic type. | ||
|
||
Generated by [gomarkdoc](<https://github.com/princjef/gomarkdoc>) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package generics | ||
|
||
// Generic is a generic struct. | ||
type Generic[T any] struct { | ||
Field T | ||
} | ||
|
||
// NewGeneric produces a new [Generic] struct. | ||
func NewGeneric[T any](param T) Generic[T] { | ||
return Generic[T]{Field: param} | ||
} | ||
|
||
// Method is a method of a generic type. | ||
func (g Generic[T]) Method() {} | ||
|
||
// Func is a generic function. | ||
func Func[S int | float64](s S) S { | ||
return s | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters