vitess.io/vitess@v0.16.2/go/mysql/collations/cached_size.go (about) 1 /* 2 Copyright 2021 The Vitess Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 // Code generated by Sizegen. DO NOT EDIT. 17 18 package collations 19 20 import hack "vitess.io/vitess/go/hack" 21 22 type cachedObject interface { 23 CachedSize(alloc bool) int64 24 } 25 26 func (cached *eightbitWildcard) CachedSize(alloc bool) int64 { 27 if cached == nil { 28 return int64(0) 29 } 30 size := int64(0) 31 if alloc { 32 size += int64(32) 33 } 34 // field sort *[256]byte 35 if cached.sort != nil { 36 size += hack.RuntimeAllocSize(int64(cap(*cached.sort))) 37 } 38 // field pattern []int16 39 { 40 size += hack.RuntimeAllocSize(int64(cap(cached.pattern)) * int64(2)) 41 } 42 return size 43 } 44 func (cached *fastMatcher) CachedSize(alloc bool) int64 { 45 if cached == nil { 46 return int64(0) 47 } 48 size := int64(0) 49 if alloc { 50 size += int64(48) 51 } 52 // field pattern []byte 53 { 54 size += hack.RuntimeAllocSize(int64(cap(cached.pattern))) 55 } 56 return size 57 } 58 func (cached *unicodeWildcard) CachedSize(alloc bool) int64 { 59 if cached == nil { 60 return int64(0) 61 } 62 size := int64(0) 63 if alloc { 64 size += int64(48) 65 } 66 // field charset vitess.io/vitess/go/mysql/collations/internal/charset/types.Charset 67 if cc, ok := cached.charset.(cachedObject); ok { 68 size += cc.CachedSize(true) 69 } 70 // field pattern []rune 71 { 72 size += hack.RuntimeAllocSize(int64(cap(cached.pattern)) * int64(4)) 73 } 74 return size 75 }