vm: add bufBinWriter to emit functions in order to catch errors
This commit is contained in:
parent
821c9b2851
commit
d02673c112
6 changed files with 93 additions and 57 deletions
|
@ -19,6 +19,11 @@ func NewBufBinWriter() *BufBinWriter {
|
|||
return &BufBinWriter{BinWriter: NewBinWriterFromIO(b), buf: b}
|
||||
}
|
||||
|
||||
// Len returns the number of bytes of the unread portion of the buffer.
|
||||
func (bw *BufBinWriter) Len() int {
|
||||
return bw.buf.Len()
|
||||
}
|
||||
|
||||
// Bytes returns resulting buffer and makes future writes return an error.
|
||||
func (bw *BufBinWriter) Bytes() []byte {
|
||||
if bw.Err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue