mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-01-19 05:45:21 +01:00
tlv: add axiomatic RecordProducer implementation for Record
This commit introduces a RecordProducer implementation for Record that serves as the identity function. This makes it easier for us to mix Primitive and Dynamic records in the same RecordProducer collections.
This commit is contained in:
parent
2ccf58e2af
commit
6257df31e0
@ -63,6 +63,15 @@ type Record struct {
|
|||||||
decoder Decoder
|
decoder Decoder
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Record (the function) is the trivial implementation of RecordProducer for
|
||||||
|
// Record (the type). This makes it seamless to mix primitive and dynamic
|
||||||
|
// records together in the same collections.
|
||||||
|
//
|
||||||
|
// NOTE: Part of the RecordProducer interface.
|
||||||
|
func (f *Record) Record() Record {
|
||||||
|
return *f
|
||||||
|
}
|
||||||
|
|
||||||
// Size returns the size of the Record's value. If no static size is known, the
|
// Size returns the size of the Record's value. If no static size is known, the
|
||||||
// dynamic size will be evaluated.
|
// dynamic size will be evaluated.
|
||||||
func (f *Record) Size() uint64 {
|
func (f *Record) Size() uint64 {
|
||||||
|
Loading…
Reference in New Issue
Block a user