// writeDecsTo writes the element's declarations to w.
507903
func (eBase *elementBase) writeDecsTo(w io.Writer, params map[string]string) (int64, error) {
	bf := new(bytes.Buffer)

	// Write the declarations.
	for _, dec := range eBase.decs {
		// Writing to the bytes.Buffer never returns an error.
		dec.writeTo(bf, params)
	}

	// Write the mixin's declarations.
	for _, mi := range eBase.mixins {
		decs, prms := mi.decsParams()

		for _, dec := range decs {
			// Writing to the bytes.Buffer never returns an error.
			dec.writeTo(bf, prms)
		}
	}

	n, err := w.Write(bf.Bytes())

	return int64(n), err
}
442600
func (i *InstructionClearActions) WriteTo(w io.Writer) (int64, error) {
	return writeInstructionActions(w, i.Type(), nil)
}
582459
func (notNull NotNull) WriteTo(w Writer) error {
	_, err := fmt.Fprintf(w, "%s IS NOT NULL", w.Key(notNull[0]))
	return err
}
113740
func (g *GroupFeatures) WriteTo(w io.Writer) (int64, error) {
	return encoding.WriteTo(w, g.Types, g.Capabilities,
		g.MaxGroups, g.Actions)
}
322574
func (h *HelloElemVersionBitmap) WriteTo(w io.Writer) (int64, error) {
	// Calculate the padding used to align the list of bitmaps.
	maplen := len(h.Bitmaps) * 4
	padding := make([]byte, (helloElemLen+maplen)%8)

	// Total length of the element includes the length of the
	// optional header, length of the bitmaps and the padding
	// used to align the message to 64-bits border.
	totalLen := helloElemLen + maplen + len(padding)

	// Compose the header of the element and marshal it
	// altogether with a version bitmaps and required padding.
	header := helloElem{h.Type(), uint16(totalLen)}
	return encoding.WriteTo(w, header, h.Bitmaps, padding)
}
1254787
func (m *MeterBandDSCPRemark) WriteTo(w io.Writer) (int64, error) {
	header := meterBand{m.Type(), meterBandLen}
	return encoding.WriteTo(w, header, m.Rate,
		m.BurstSize, m.PrecLevel, pad3{})
}
269597
func (a *AsyncConfig) WriteTo(w io.Writer) (int64, error) {
	return encoding.WriteTo(w, a.PacketInMask,
		a.PortStatusMask, a.FlowRemovedMask)
}
996693
func (c *Component) writeTo(b *strings.Builder) {
	b.WriteByte('/')
	b.WriteString(c.protocol.Name)
	value := c.Value()
	if len(value) == 0 {
		return
	}
	if !(c.protocol.Path && value[0] == '/') {
		b.WriteByte('/')
	}
	b.WriteString(value)
}
1264599
func (t Time) WriteTo(w Writer) error {
	bytes, err := time.Time(t).MarshalBinary()
	if err != nil {
		return errorsp.WithStacks(err)
	}
	return errorsp.WithStacks(ByteSlice(bytes).WriteTo(w))
}
61718
func (neq Neq) WriteTo(w Writer) error {
	var args = make([]interface{}, 0, len(neq))
	var i = 0
	for _, k := range neq.sortedKeys() {
		v := neq[k]
		switch v.(type) {
		case []int, []int64, []string, []int32, []int16, []int8:
			if err := NotIn(k, v).WriteTo(w); err != nil {
				return err
			}
		case expr:
			if _, err := fmt.Fprintf(w, "%s<>(", k); err != nil {
				return err
			}

			if err := v.(expr).WriteTo(w); err != nil {
				return err
			}

			if _, err := fmt.Fprintf(w, ")"); err != nil {
				return err
			}
		case *Builder:
			if _, err := fmt.Fprintf(w, "%s<>(", k); err != nil {
				return err
			}

			if err := v.(*Builder).WriteTo(w); err != nil {
				return err
			}

			if _, err := fmt.Fprintf(w, ")"); err != nil {
				return err
			}
		default:
			if _, err := fmt.Fprintf(w, "%s<>?", k); err != nil {
				return err
			}
			args = append(args, v)
		}
		if i != len(neq)-1 {
			if _, err := fmt.Fprint(w, " AND "); err != nil {
				return err
			}
		}
		i = i + 1
	}
	w.Append(args...)
	return nil
}
148315
func (t *Template) WriteTo(w io.Writer) (n int64, err error) {
	var buf bytes.Buffer

	// Write "generated" header comment.
	buf.WriteString("// Generated by ego.\n")
	buf.WriteString("// DO NOT EDIT\n\n")

	// Write blocks.
	writeBlocksTo(&buf, t.Blocks)

	// Parse buffer as a Go file.
	fset := token.NewFileSet()
	f, err := parser.ParseFile(fset, "", buf.Bytes(), parser.ParseComments)
	if err != nil {
		n, _ = buf.WriteTo(w)
		return n, err
	}

	// Inject required packages.
	injectImports(f)

	// Attempt to gofmt.
	var result bytes.Buffer
	if err := format.Node(&result, fset, f); err != nil {
		n, _ = buf.WriteTo(w)
		return n, err
	}

	// Write to output writer.
	return result.WriteTo(w)
}
403342
func (s *SwitchFeatures) WriteTo(w io.Writer) (int64, error) {
	return encoding.WriteTo(w,
		s.DatapathID, s.NumBuffers, s.NumTables, s.AuxiliaryID,
		pad2{}, s.Capabilities, s.Reserved)
}
389794
func (b *ByteBuffer) WriteTo(w io.Writer) (int64, error) {
	n, err := w.Write(b.B)
	return int64(n), err
}
1098072
func (sf *scriptFlags) WriteTo(w io.Writer) (int64, error) {
	var b [8]byte
	if sf.hasScript {
		b[0] |= 1 << 1
	}
	if sf.change {
		b[0] |= 1 << 5
	}
	if sf.unsynced {
		b[0] |= 1 << 6
	}
	if sf.partialSync {
		b[0] |= 1 << 7
	}

	n, err := w.Write(b[:])
	return int64(n), err
}
1106630
func (s String) WriteTo(w Writer) error {
	return ByteSlice(s).WriteTo(w)
}
1250133
func (t *TablePropNextTables) WriteTo(w io.Writer) (int64, error) {
	headerlen := tablePropLen + len(t.NextTables)
	header := tableProp{t.Type(), uint16(headerlen)}

	padding := makePad(headerlen)
	return encoding.WriteTo(w, header, t.NextTables, padding)
}
350792
func (s Slice) WriteTo(w io.Writer) (n int64, err error) {
	nWrite, err := w.Write(s)
	return int64(nWrite), err
}