// Clone creates a new Middleware instance based on the current one.
553492
func (s *Layer) Clone() Middleware {
	mw := New()
	mw.parent = s.parent
	s.mtx.Lock()
	mw.stack = append([]plugin.Plugin(nil), s.stack...)
	s.mtx.Unlock()
	return mw
}
11387
func (ds *DiskSource) Clone() Source {
	dsc := &DiskSource{
		BasePath:       ds.BasePath,
		BlockAddresses: ds.BlockAddresses,

		Container: ds.Container,
	}

	if ds.Decompressor != nil {
		dsc.Decompressor = ds.Decompressor.Clone()
	}

	return dsc
}
1234028
func (l *Logger) Clone() *Logger {
	newLogger, _ := l.client.NewLogger()

	for attrKey, attrVal := range l.attrs {
		newLogger.SetAttr(attrKey, attrVal)
	}

	return newLogger
}
1101507
func (s *OrderedSet) Clone() *OrderedSet {
	clone := NewOrderedSetWithCapacity(s.Cardinality())
	for _, i := range s.s {
		clone.Add(i)
	}
	return clone
}
675548
func (basicAccount *BasicAccount) Clone() BasicAccount {
	return BasicAccount{
		Address: basicAccount.Address,
		Amount:  basicAccount.Amount,
	}
}
1272881
func (c *ClassList) Clone() *ClassList {
	cl := ClassList{
		list: append([]string{}, c.list...),
	}

	return &cl
}
240882
func (r Rules) Clone() Rules {
	out := map[string][]Rule{}
	for key, rules := range r {
		out[key] = make([]Rule, len(rules))
		copy(out[key], rules)
	}
	return out
}
1030390
func (k *Keyspace) Clone() *Keyspace {
	return &Keyspace{Start: k.Start, End: k.End}
}
13994
func (c Collector) Clone() Collector {
	col := make(Collector)
	col.Copy(c)
	return col
}
304426
func Clone(src []byte) []byte {
	clone := make([]byte, len(src))
	copy(clone, src)

	return clone
}
1109622
func (p *Path) clone() *Path {
	stack := p.stack
	p.stack = stack[:len(stack):len(stack)]
	return &Path{
		stack:       stack,
		qs:          p.qs,
		baseContext: p.baseContext,
	}
}
1145551
func (cl *CommandLine) Clone() *CommandLine {
	return &CommandLine{
		Target: cl.Target,
		Flags:  append([]CommandLineFlag(nil), cl.Flags...),
		Args:   append([]string(nil), cl.Args...),
	}
}
1189852
func (c *config) clone() *config {
	new := &config{
		threshold:   c.threshold,
		frames:      c.frames,
		errorFrames: c.errorFrames,
		registry:    make(registry),
	}
	for collector, entry := range c.registry {
		new.registry[collector] = entry.clone()
	}
	return new
}
338866
func (ds *DiskSink) Clone() Sink {
	dsc := &DiskSink{
		BasePath: ds.BasePath,

		Container:   ds.Container,
		BlockHashes: ds.BlockHashes,
	}

	if ds.Compressor != nil {
		dsc.Compressor = ds.Compressor.Clone()
	}

	return dsc
}
423739
func (b *Backoffer) Clone() *Backoffer {
	return &Backoffer{
		ctx:        b.ctx,
		maxSleep:   b.maxSleep,
		totalSleep: b.totalSleep,
		errors:     b.errors,
		vars:       b.vars,
	}
}
303152
func (p *BlockPuller) Clone() *BlockPuller {
	// Clone by value
	copy := *p
	// Reset internal state
	copy.stream = nil
	copy.blockBuff = nil
	copy.latestSeq = 0
	copy.endpoint = ""
	copy.conn = nil
	copy.cancelStream = nil
	return &copy
}
193661
func (s *ServiceState) Clone() *ServiceState {
	s2 := new(ServiceState)
	*s2 = *s
	return s2
}