Documentation ¶
Index ¶
- Variables
- func Deserialize[T any](raw string) T
- func DeserializeValue(ty reflect.Type, raw string) (reflect.Value, error)
- func JoinArray(s []string) string
- func MustSplitArray(raw string) []string
- func ReadLine(r *bufio.Reader) string
- func Serialize(v any) string
- func SplitArray(raw string) ([]string, error)
- type ListNode
- type NaryTreeNode
- type Node
- type TreeNode
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInfiniteLoop = errors.New("infinite loop detected")
Functions ¶
func Deserialize ¶
Deserialize deserialize a string to a type.
func DeserializeValue ¶
DeserializeValue deserialize a string to a reflect.Value
func MustSplitArray ¶
MustSplitArray is a wrapper of Deserialize which panics if an error occurs.
func SplitArray ¶
SplitArray splits a comma separated array string which may contain different types into a slice of strings.
Types ¶
type ListNode ¶
func DeserializeListNode ¶
func (*ListNode) String ¶ added in v0.2.1
String returns a string representation of the linked list. It panics with ErrInfiniteLoop if a cycle is detected.
type NaryTreeNode ¶
type NaryTreeNode struct { Val int Children []*NaryTreeNode }
func DeserializeNaryTreeNode ¶
func DeserializeNaryTreeNode(s string) (*NaryTreeNode, error)
func (*NaryTreeNode) String ¶ added in v0.2.1
func (t *NaryTreeNode) String() string
String returns a string representation of the nary tree. It panics with ErrInfiniteLoop if a cycle is detected.
func (*NaryTreeNode) ToString ¶
func (t *NaryTreeNode) ToString() string
ToString is deprecated, use String
Click to show internal directories.
Click to hide internal directories.