bytesconv.go — gin Source File
Architecture documentation for bytesconv.go, a go file in the gin codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR ad485a25_6538_d1cf_9172_48a670eae618["bytesconv.go"] eb89a7cc_da03_a189_ab2b_9ad42bfd3d3e["unsafe"] ad485a25_6538_d1cf_9172_48a670eae618 --> eb89a7cc_da03_a189_ab2b_9ad42bfd3d3e style ad485a25_6538_d1cf_9172_48a670eae618 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
// Copyright 2023 Gin Core Team. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
package bytesconv
import (
"unsafe"
)
// StringToBytes converts string to byte slice without a memory allocation.
// For more details, see https://github.com/golang/go/issues/53003#issuecomment-1140276077.
func StringToBytes(s string) []byte {
return unsafe.Slice(unsafe.StringData(s), len(s))
}
// BytesToString converts byte slice to string without a memory allocation.
// For more details, see https://github.com/golang/go/issues/53003#issuecomment-1140276077.
func BytesToString(b []byte) string {
return unsafe.String(unsafe.SliceData(b), len(b))
}
Domain
Subdomains
Functions
Dependencies
- unsafe
Source
Frequently Asked Questions
What does bytesconv.go do?
bytesconv.go is a source file in the gin codebase, written in go. It belongs to the InternalUtilities domain, MemoryOptimization subdomain.
What functions are defined in bytesconv.go?
bytesconv.go defines 2 function(s): BytesToString, StringToBytes.
What does bytesconv.go depend on?
bytesconv.go imports 1 module(s): unsafe.
Where is bytesconv.go in the architecture?
bytesconv.go is located at internal/bytesconv/bytesconv.go (domain: InternalUtilities, subdomain: MemoryOptimization, directory: internal/bytesconv).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free