1 Star 2 Fork 0

李文建 / light-protoactor-go

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
behaviorstack.go 618 Bytes
一键复制 编辑 原始数据 按行查看 历史
package actor
type behaviorStack []ActorFunc
func (b *behaviorStack) Clear() {
if len(*b) == 0 {
return
}
for i := range *b {
(*b)[i] = nil
}
*b = (*b)[:0]
}
func (b *behaviorStack) Peek() (v ActorFunc, ok bool) {
l := b.Len()
if l > 0 {
ok = true
v = (*b)[l-1]
}
return
}
func (b *behaviorStack) Push(v ActorFunc) {
*b = append(*b, v)
}
func (b *behaviorStack) Pop() (v ActorFunc, ok bool) {
l := b.Len()
if l > 0 {
l--
ok = true
v = (*b)[l]
(*b)[l] = nil
*b = (*b)[:l]
}
return
}
func (b *behaviorStack) Len() int {
return len(*b)
}
Go
1
https://gitee.com/lwj8507/light-protoactor-go.git
git@gitee.com:lwj8507/light-protoactor-go.git
lwj8507
light-protoactor-go
light-protoactor-go
013e33d7022f

搜索帮助