Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for IteratorFunc (0.1 sec)

  1. test/typeparam/issue48602.go

    // license that can be found in the LICENSE file.
    
    package main
    
    type Iterator[T any] interface {
    	Iterate(fn T)
    }
    
    type IteratorFunc[T any] func(fn T)
    
    func (f IteratorFunc[T]) Iterate(fn T) {
    	f(fn)
    }
    
    func Foo[R any]() {
    	var _ Iterator[R] = IteratorFunc[R](nil)
    }
    
    func main() {
    	Foo[int]()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 01 19:45:34 UTC 2022
    - 414 bytes
    - Viewed (0)
  2. test/typeparam/issue48598.go

    package main
    
    type Iterator[T any] interface {
    	Iterate()
    }
    
    type IteratorFunc[T any] func(fn func(T) bool)
    
    func (f IteratorFunc[T]) Iterate() {
    }
    
    func FromIterator[T any](it Iterator[T]) {
    	it.Iterate()
    }
    
    func Foo[T, R any]() {
    	FromIterator[R](IteratorFunc[R](nil))
    }
    
    func main() {
    	Foo[int, int]()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 01 19:45:34 UTC 2022
    - 475 bytes
    - Viewed (0)
  3. test/typeparam/issue48645b.go

    // license that can be found in the LICENSE file.
    
    package main
    
    type Iterator[T any] interface {
    	Iterate(fn func(T) bool)
    }
    
    type IteratorFunc[T any] func(fn func(T) bool)
    
    func (f IteratorFunc[T]) Iterate(fn func(T) bool) {
    	f(fn)
    }
    
    type Stream[T any] struct {
    	it Iterator[T]
    }
    
    func (s Stream[T]) Iterate(fn func(T) bool) {
    	if s.it == nil {
    		return
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 01 19:45:34 UTC 2022
    - 1.4K bytes
    - Viewed (0)
Back to top