一、介绍
ring是一个首尾相连的list,源码位于 src/container/ring/ring.go
其中每一个元素的定义如下:
// A Ring is an element of a circular list, or ring.
// Rings do not have a beginning or end;
a pointer to any ring element
// serves as reference to the entire ring. Empty rings are represented
// as nil Ring pointers. The zero value for a Ring is a one-element
// ring with a nil Value.
//
type Ring struct {
next, prev *Ring
Valueinterface{} // for use by client;
untouched by this library
}
【go源码阅读 container/ring】通过New方法可以创建一个特定大小的ring,例如:
r := ring.New(5)
推荐阅读
- GO实践笔记
- go|vue-element-admin 后台动态加载菜单
- 迈向高级的Java面试突围课|完结
- 2022最新慕课网实战课程大全_资料完整_百度网盘分享
- 执行 go vendor 时第三方包 go 版本冲突问题的解决方法
- golang网络数据交换
- go reflect struct (go反射与struct结构体)
- 用原生Go写一个自己的博客-搭建项目
- 极客时间-Go进阶训练营|全新升级第4期|完结无密