- Sort Score
- Result 10 results
- Languages All
Results 1 - 2 of 2 for setlkw (0.14 sec)
-
src/reflect/all_test.go
vs := ValueOf(&xs).Elem() shouldPanic("SetLen", func() { vs.SetLen(10) }) shouldPanic("SetCap", func() { vs.SetCap(10) }) shouldPanic("SetLen", func() { vs.SetLen(-1) }) shouldPanic("SetCap", func() { vs.SetCap(-1) }) shouldPanic("SetCap", func() { vs.SetCap(6) }) // smaller than len vs.SetLen(5) if len(xs) != 5 || cap(xs) != 8 { t.Errorf("after SetLen(5), len, cap = %d, %d, want 5, 8", len(xs), cap(xs)) }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu May 23 01:00:11 UTC 2024 - 218.8K bytes - Viewed (0) -
src/reflect/value.go
*(*int64)(v.ptr) = x } } // SetLen sets v's length to n. // It panics if v's Kind is not [Slice] or if n is negative or // greater than the capacity of the slice. func (v Value) SetLen(n int) { v.mustBeAssignable() v.mustBe(Slice) s := (*unsafeheader.Slice)(v.ptr) if uint(n) > uint(s.Cap) { panic("reflect: slice length out of range in SetLen") } s.Len = n }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed May 22 21:17:41 UTC 2024 - 119.9K bytes - Viewed (0)