behavior

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2024 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Behavior

type Behavior[T any] interface {
	Become(performance Performance[T])

	BecomeStacked(performance Performance[T])

	UnBecomeStacked()

	Perform(ctx T)
}

func New

func New[T any]() Behavior[T]

type FunctionalPerformance

type FunctionalPerformance[T any] func(ctx T)

FunctionalPerformance 函数式的行为表现,它实现了 Performance 接口

func (FunctionalPerformance[T]) Perform

func (f FunctionalPerformance[T]) Perform(ctx T)

Perform 履行行为

type FunctionalStatefulPerformance

type FunctionalStatefulPerformance[T any] func() Performance[T]

FunctionalStatefulPerformance 函数式有状态的行为表现

func (FunctionalStatefulPerformance[T]) Stateful

func (f FunctionalStatefulPerformance[T]) Stateful() Performance[T]

Stateful 将其状态化

type Performance

type Performance[T any] interface {
	// Perform 履行行为
	Perform(ctx T)
}

Performance 行为具体表现

Jump to

Keyboard shortcuts

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