Skip to content

Add methods for appending Buildable objects to buffer.#1

Merged
oherrala merged 4 commits intomainfrom
append-buildable
Apr 15, 2025
Merged

Add methods for appending Buildable objects to buffer.#1
oherrala merged 4 commits intomainfrom
append-buildable

Conversation

@jtt
Copy link
Contributor

@jtt jtt commented Apr 13, 2025

Adds two methods, append() and append_all() to Builder. append() allows to add a Buildable to the end of buffer and append_all() can be used to append a slice of Buildables to the end of the buffer. Both methods will call the build() method of buildable to write data to buffer. If error occurs while appending data, the index of buffer is reset back to where it was when append() or append_all() was called.

Also add a new error type Error::InvalidData which allows the build() method of Buildable to signal that data was invalid and could not be written into buffer.

jtt added 2 commits April 11, 2025 14:58
Adds method append() which can be used to append a result of building a
Buildable to the end of buffer.
@jtt jtt requested a review from oherrala April 13, 2025 19:04
jtt added 2 commits April 14, 2025 21:33
This can be used when implementing Buildable and want to indicate caller
that some elements of the data were invalid and could not be built.
@jtt jtt force-pushed the append-buildable branch from 9a3b6ac to d1d1e62 Compare April 14, 2025 18:35
@oherrala oherrala merged commit de19b78 into main Apr 15, 2025
3 checks passed
@oherrala oherrala added the enhancement New feature or request label Apr 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants