-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: implement the version with generics #1
base: main
Are you sure you want to change the base?
Conversation
@@ -3,25 +3,25 @@ package stream | |||
import "sync" | |||
|
|||
// A Ring can be used as fixed size ring. | |||
type Ring struct { | |||
elements []interface{} | |||
type Ring[T any] struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
index int | ||
lock sync.Mutex | ||
} | ||
|
||
// NewRing returns a Ring object with the given size n. | ||
func NewRing(n int) *Ring { | ||
func NewRing[T any](n int) *Ring[T] { | ||
if n < 1 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there anything preventing this PR from being merged? |
Yes, go template doesn't support |
No description provided.