Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for insertAfterFunc (0.15 sec)

  1. pilot/pkg/networking/core/envoyfilter/util_test.go

    				t.Errorf("insertBeforeFunc: want %+v but got %+v", c.applied, applied)
    			}
    
    			// insertAfterFunc
    			got, applied = insertAfterFunc(slices.Clone(c.input), f)
    			if !slices.Equal(c.insertAfter, got) {
    				t.Errorf("insertAfterFunc: want %+v but got %+v", c.insertAfter, got)
    			}
    			if c.applied != applied {
    				t.Errorf("insertAfterFunc: want %+v but got %+v", c.applied, applied)
    			}
    		})
    	}
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Thu Mar 28 17:09:02 UTC 2024
    - 3.2K bytes
    - Viewed (0)
  2. pilot/pkg/networking/core/envoyfilter/util.go

    	}
    
    	s = append(s, toInsert) // for grow the cap
    	copy(s[idx+1:], s[idx:])
    	s[idx] = toInsert
    
    	return s, true
    }
    
    // insertAfterFunc find and insert an element after the found element.
    // If the f function returns true, the returned value will be inserted after the found element.
    func insertAfterFunc[E any](s []E, f func(e E) (bool, E)) ([]E, bool) {
    	var toInsert E
    	idx := -1
    	for k, v := range s {
    		if ok, r := f(v); ok {
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Thu Mar 28 17:09:02 UTC 2024
    - 2.1K bytes
    - Viewed (0)
Back to top