inspectable_byte_string

package
v0.2.32 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 12, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InspectableByteString

type InspectableByteString struct {
	// contains filtered or unexported fields
}

func NewInspectableByteString

func NewInspectableByteString(bytes []byte) InspectableByteString

func (InspectableByteString) FormatWithHighlightedOffset

func (s InspectableByteString) FormatWithHighlightedOffset(highlightOffset int, highlightText string, formattedStringPrefix string, formattedStringSuffix string) string

FormatWithHighlightedOffset returns a string that represents the bytes with the byteOffset highlighted

For example, if called with highlightOffset 4, highlightText "error" and formattedString "Received: ", the return value will be:

> Received: "+OK\r\n" > ^ error

func (InspectableByteString) FormattedString

func (s InspectableByteString) FormattedString() string

func (InspectableByteString) GetOffsetInFormattedString

func (s InspectableByteString) GetOffsetInFormattedString(byteOffset int) int

GetOffsetInFormattedString returns a string that represents the byteOffset in the formatted string

For example:

  • If the string is "+OK\r\n"
  • And byteOffset is 4 (i.e. \n, the 5th byte)
  • The return value will be 6 (i.e. the 6th character in the formatted string)

func (InspectableByteString) TruncateAroundOffset

func (s InspectableByteString) TruncateAroundOffset(offset int) InspectableByteString

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL