blob: e07899b909bb0321d4378af4a9feda064ddd10d0 [file] [log] [blame]
David K. Bainbridgee05cf0c2021-08-19 03:16:50 +00001// Copyright 2020 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5// Package unsafeheader contains header declarations for the Go runtime's
6// slice and string implementations.
7//
8// This package allows x/sys to use types equivalent to
9// reflect.SliceHeader and reflect.StringHeader without introducing
10// a dependency on the (relatively heavy) "reflect" package.
11package unsafeheader
12
13import (
14 "unsafe"
15)
16
17// Slice is the runtime representation of a slice.
18// It cannot be used safely or portably and its representation may change in a later release.
19type Slice struct {
20 Data unsafe.Pointer
21 Len int
22 Cap int
23}
24
25// String is the runtime representation of a string.
26// It cannot be used safely or portably and its representation may change in a later release.
27type String struct {
28 Data unsafe.Pointer
29 Len int
30}