// Serialize returns the byte representation of the current Store.
428527
func (r Store) Serialize() []byte {
	w := new(bytes.Buffer)
	enc := gob.NewEncoder(w)
	err := enc.Encode(r)
	if err != nil {
		return nil
	}

	return w.Bytes()
}
287183
func (JSONSerializer) Serialize(spans []*model.SpanModel) ([]byte, error) {
	return json.Marshal(spans)
}
395560
func (j JSONStateSerializer) Serialize(state interface{}) (string, error) {
	var b bytes.Buffer
	if err := json.NewEncoder(&b).Encode(state); err != nil {
		return "", err
	}
	return b.String(), nil
}
1233583
func (key *Key) Serialize() ([]byte, error) {
	// Private keys should be prepended with a single null byte
	keyBytes := key.Key
	if key.IsPrivate {
		keyBytes = append([]byte{0x0}, keyBytes...)
	}

	// Write fields to buffer in order
	buffer := new(bytes.Buffer)
	buffer.Write(key.Version)
	buffer.WriteByte(key.Depth)
	buffer.Write(key.FingerPrint)
	buffer.Write(key.ChildNumber)
	buffer.Write(key.ChainCode)
	buffer.Write(keyBytes)

	// Append the standard doublesha256 checksum
	serializedKey, err := addChecksumToBytes(buffer.Bytes())
	if err != nil {
		return nil, err
	}

	return serializedKey, nil
}
135015
func (e *Serializer) Serialize(val interface{}, options ...map[string]interface{}) ([]byte, error) {
	var result []byte
	var err error
	if e.config.Indent {
		result, err = json.MarshalIndent(val, "", "  ")
	} else {
		result, err = json.Marshal(val)
	}

	if err != nil {
		return nil, err
	}

	// the config's callback can be overriden with the options
	callback := e.config.Callback
	if len(options) > 0 {
		callback = e.getCallbackOption(options[0])
	}

	if callback != "" {
		result = append([]byte(callback+"("), result...)
		result = append(result, finishCallbackB...)
	}

	if e.config.Indent {
		result = append(result, newLineB...)
	}
	return result, nil
}
349703
func Serialize(key string, obj interface{}, options ...map[string]interface{}) ([]byte, error) {
	// only to the default serializer, check if no of the built'n serializer's key are registered, if not register them here
	// I don't put it to the initialize of the defaultSerializers because the developer may don't want the built'n serializers at all
	once.Do(func() {
		RegisterDefaults(defaultSerializers)
	})

	return defaultSerializers.Serialize(key, obj, options...)
}
691838
func (e *Serializer) Serialize(val interface{}, options ...map[string]interface{}) ([]byte, error) {
	if e.config.StreamingJSON {
		w := buffer.Get()
		if len(e.config.Prefix) > 0 {
			w.Write(e.config.Prefix)
		}
		err := json.NewEncoder(w).Encode(val)
		result := w.Bytes()
		buffer.Put(w)
		return result, err
	}

	var result []byte
	var err error

	if e.config.Indent {
		result, err = json.MarshalIndent(val, "", "  ")
		result = append(result, newLineB...)
	} else {
		result, err = json.Marshal(val)
	}
	if err != nil {
		return nil, err
	}

	if e.config.UnEscapeHTML {
		result = bytes.Replace(result, ltHex, lt, -1)
		result = bytes.Replace(result, gtHex, gt, -1)
		result = bytes.Replace(result, andHex, and, -1)
	}
	if len(e.config.Prefix) > 0 {
		result = append(e.config.Prefix, result...)
	}
	return result, nil
}
629523
func (prof *Profiler) Serialize(u *structs.DevUsage) ([]byte, error) {
	return json.Marshal(u)
}
750684
func (prof *Profiler) Serialize(inf *structs.DevInfo) ([]byte, error) {
	return json.Marshal(inf)
}
17676
func (prof *Profiler) Serialize(inf *mem.Info) []byte {
	// ensure the Builder is in a usable state.
	prof.Builder.Reset()
	structs.InfoStart(prof.Builder)
	structs.InfoAddTimestamp(prof.Builder, inf.Timestamp)
	structs.InfoAddActive(prof.Builder, inf.Active)
	structs.InfoAddActiveAnon(prof.Builder, inf.ActiveAnon)
	structs.InfoAddActiveFile(prof.Builder, inf.ActiveFile)
	structs.InfoAddAnonHugePages(prof.Builder, inf.AnonHugePages)
	structs.InfoAddAnonPages(prof.Builder, inf.AnonPages)
	structs.InfoAddBounce(prof.Builder, inf.Bounce)
	structs.InfoAddBuffers(prof.Builder, inf.Buffers)
	structs.InfoAddCached(prof.Builder, inf.Cached)
	structs.InfoAddCommitLimit(prof.Builder, inf.CommitLimit)
	structs.InfoAddCommittedAS(prof.Builder, inf.CommittedAS)
	structs.InfoAddDirectMap4K(prof.Builder, inf.DirectMap4K)
	structs.InfoAddDirectMap2M(prof.Builder, inf.DirectMap2M)
	structs.InfoAddDirty(prof.Builder, inf.Dirty)
	structs.InfoAddHardwareCorrupted(prof.Builder, inf.HardwareCorrupted)
	structs.InfoAddHugePagesFree(prof.Builder, inf.HugePagesFree)
	structs.InfoAddHugePagesRsvd(prof.Builder, inf.HugePagesRsvd)
	structs.InfoAddHugePagesSize(prof.Builder, inf.HugePagesSize)
	structs.InfoAddHugePagesSurp(prof.Builder, inf.HugePagesSurp)
	structs.InfoAddHugePagesTotal(prof.Builder, inf.HugePagesTotal)
	structs.InfoAddInactive(prof.Builder, inf.Inactive)
	structs.InfoAddInactiveAnon(prof.Builder, inf.InactiveAnon)
	structs.InfoAddInactiveFile(prof.Builder, inf.InactiveFile)
	structs.InfoAddKernelStack(prof.Builder, inf.KernelStack)
	structs.InfoAddMapped(prof.Builder, inf.Mapped)
	structs.InfoAddMemAvailable(prof.Builder, inf.MemAvailable)
	structs.InfoAddMemFree(prof.Builder, inf.MemFree)
	structs.InfoAddMemTotal(prof.Builder, inf.MemTotal)
	structs.InfoAddMlocked(prof.Builder, inf.Mlocked)
	structs.InfoAddNFSUnstable(prof.Builder, inf.NFSUnstable)
	structs.InfoAddPageTables(prof.Builder, inf.PageTables)
	structs.InfoAddShmem(prof.Builder, inf.Shmem)
	structs.InfoAddSlab(prof.Builder, inf.Slab)
	structs.InfoAddSReclaimable(prof.Builder, inf.SReclaimable)
	structs.InfoAddSUnreclaim(prof.Builder, inf.SUnreclaim)
	structs.InfoAddSwapCached(prof.Builder, inf.SwapCached)
	structs.InfoAddSwapFree(prof.Builder, inf.SwapFree)
	structs.InfoAddSwapTotal(prof.Builder, inf.SwapTotal)
	structs.InfoAddUnevictable(prof.Builder, inf.Unevictable)
	structs.InfoAddVmallocChunk(prof.Builder, inf.VmallocChunk)
	structs.InfoAddVmallocTotal(prof.Builder, inf.VmallocTotal)
	structs.InfoAddVmallocUsed(prof.Builder, inf.VmallocUsed)
	structs.InfoAddWriteback(prof.Builder, inf.Writeback)
	structs.InfoAddWritebackTmp(prof.Builder, inf.WritebackTmp)
	prof.Builder.Finish(structs.InfoEnd(prof.Builder))
	p := prof.Builder.Bytes[prof.Builder.Head():]
	// copy them (otherwise gets lost in reset)
	tmp := make([]byte, len(p))
	copy(tmp, p)
	return tmp
}
794787
func (w *Writer) Serialize(v interface{}) *Writer {
	if v == nil {
		w.WriteNil()
	} else if rv, ok := v.(reflect.Value); ok {
		w.WriteValue(rv)
	} else {
		w.WriteValue(reflect.ValueOf(v))
	}
	return w
}
796576
func (msg *MsgBlock) SerializeSize() int {
	// Block header bytes + Serialized varint size for the number of
	// transactions.
	n := blockHeaderLen + VarIntSerializeSize(uint64(len(msg.Transactions)))

	for _, tx := range msg.Transactions {
		n += tx.SerializeSize()
	}

	return n
}
748257
func Serialize(st *stats.CPUStats) (p []byte, err error) {
	stdMu.Lock()
	defer stdMu.Unlock()
	if std == nil {
		std, err = NewProfiler()
		if err != nil {
			return nil, err
		}
	}
	return std.Serialize(st)
}
1030770
func (a *Authenticator) Serialize(context.Context, oauth2.Principal) (string, error) {
	return a.Serialized, nil
}
502310
func Serialize(opts []*UnitOption) io.Reader {
	var buf bytes.Buffer

	if len(opts) == 0 {
		return &buf
	}

	// Index of sections -> ordered options
	idx := map[string][]*UnitOption{}
	// Separately preserve order in which sections were seen
	sections := []string{}
	for _, opt := range opts {
		sec := opt.Section
		if _, ok := idx[sec]; !ok {
			sections = append(sections, sec)
		}
		idx[sec] = append(idx[sec], opt)
	}

	for i, sect := range sections {
		writeSectionHeader(&buf, sect)
		writeNewline(&buf)

		opts := idx[sect]
		for _, opt := range opts {
			writeOption(&buf, opt)
			writeNewline(&buf)
		}
		if i < len(sections)-1 {
			writeNewline(&buf)
		}
	}

	return &buf
}
474998
func Serialize(name string, conf common.Conf) ([]byte, error) {
	var buf bytes.Buffer
	if conf.Transient {
		if err := transientConfT.Execute(&buf, conf); err != nil {
			return nil, err
		}
	} else {
		if err := confT.Execute(&buf, conf); err != nil {
			return nil, err
		}
	}
	return buf.Bytes(), nil
}
1314522
func (s GobSerializer) Serialize(ss *sessions.Session) ([]byte, error) {
	buf := new(bytes.Buffer)
	enc := gob.NewEncoder(buf)
	err := enc.Encode(ss.Values)
	if err == nil {
		return buf.Bytes(), nil
	}
	return nil, err
}