Barry

What is Barry? Barry is a silly little thing I wanted to try, feel free to screenshot.

If you manage to get panics after being told not to do things with the comments, such as being silly and trying to
create a Barry with a backing smaller than the length of the elements, that’s on you.

Also, you probably shouldn’t use this in production, as the things you can do with a Barry can honestly be done with
any slice, just not with pointer receivers.

Example

package main

import (
	"fmt"
	"github.com/Sepruko/barry"
)

func main() {
	b := barry.New("This is", "a new", barry.Barry{"Barry!", "Isn't that cool?"})

	fmt.Println(b) // [This is a new [Barry! Isn't that cool?]]

	b2 := b[2].(barry.Barry)
	b2.Push("It sure is!")
	b[2] = b2

	fmt.Println(b) // [This is a new [Barry! Isn't that cool? It sure is!]]

	b.Cut(1, 2)

	fmt.Println(b) // [This is [Barry! Isn't that cool? It sure is!]]

	b.Insert(1, "a new")

	b3 := b[2].(barry.Barry)
	b3.Delete(1)
	b[2] = b3

	fmt.Println(b) // This is a new [Barry! It sure is!]]
}

GitHub

View Github