FromLabelAdaptersToLabels casts []LabelAdapter to labels.Labels. It uses unsafe, but as LabelAdapter == labels.Label this should be safe. This allows us to use labels.Labels directly in protos. Note: while resulting labels.Labels is supposedly sorted, this function doesn't enforce that. If input is
(ls []LabelAdapter)
| 60 | // Note: while resulting labels.Labels is supposedly sorted, this function |
| 61 | // doesn't enforce that. If input is not sorted, output will be wrong. |
| 62 | func FromLabelAdaptersToLabels(ls []LabelAdapter) labels.Labels { |
| 63 | return *(*labels.Labels)(unsafe.Pointer(&ls)) |
| 64 | } |
| 65 | |
| 66 | // FromLabelAdaptersToLabelsWithCopy converts []LabelAdapter to labels.Labels. |
| 67 | // Do NOT use unsafe to convert between data types because this function may |
no outgoing calls