Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for IteratorFunc (0.16 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)
  4. src/cmd/compile/internal/rangefunc/rewrite.go

    		setPos(stateVarDecl, start)
    		block.List = append(block.List, stateVarDecl)
    	}
    
    	// iteratorFunc(bodyFunc)
    	block.List = append(block.List, call)
    
    	if r.checkFuncMisuse() {
    		// iteratorFunc has exited, check for swallowed panic, and set body state to abi.RF_EXHAUSTED
    		nif := &syntax.IfStmt{
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:05:44 UTC 2024
    - 41.6K bytes
    - Viewed (0)
Back to top