本文整理汇总了Golang中github.com/paulfchristiano/dwimmer/term.SettingT.Copy方法的典型用法代码示例。如果您正苦于以下问题:Golang SettingT.Copy方法的具体用法?Golang SettingT.Copy怎么用?Golang SettingT.Copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/paulfchristiano/dwimmer/term.SettingT
的用法示例。
在下文中一共展示了SettingT.Copy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Run
func (d *Dwimmer) Run(setting *term.SettingT) term.T {
goMeta := func() {
StartShell(d, Interrupted.T(represent.SettingT(setting)))
}
for {
//d.watchdog(setting)
char, sent := d.CheckCh()
if sent {
if char == 'q' {
panic("interrupted")
} else if char == 's' {
goMeta()
} else {
d.Clear()
d.Debug("(Type [s] to interrupt execution and drop into a shell)")
d.Debug("(Type [q] to interrupt execution and quit)")
}
}
transition, ok := d.Get(setting.Setting)
if !ok {
transition = ElicitAction(d, setting.Copy(), setting.Setting)
}
result := transition.Step(d, setting)
if result != nil {
return result
}
}
}
示例2: watchdog
func (d *Dwimmer) watchdog(setting *term.SettingT) {
if rand.Int()%(watchFrequency<<(3*watcherDepth)) == 0 {
watcherDepth++
defer func() { watcherDepth-- }()
parent := setting.Copy().AppendAction(term.MetaC())
oldWatcher := d.lastWatcher
newWatcher := term.InitT()
var Q term.T
if d.lastWatcher == nil {
Q = IsAllWell.T(term.MakeChannel(parent))
} else {
Q = IsAllWellPred.T(term.MakeChannel(parent), term.MakeChannel(oldWatcher))
}
d.lastWatcher = newWatcher
dynamics.SubRun(d, Q, parent, newWatcher)
}
}