diff -r 6a842bd49fea -r 5ab3fe0b7859 src/cx/buffer.h --- a/src/cx/buffer.h Mon Dec 22 16:12:20 2025 +0100 +++ b/src/cx/buffer.h Mon Dec 22 16:21:04 2025 +0100 @@ -613,6 +613,26 @@ cx_attr_nonnull CX_EXPORT int cxBufferGet(CxBuffer *buffer); +/** + * Gets the data in a buffer as a @c cxstring. + * + * @param buffer the buffer + * @return the data in the buffer interpreted as a @c cxstring + */ +CX_INLINE cxstring cx_bstr(CxBuffer *buffer) { + return cx_strn(buffer->space, buffer->size); +} + +/** + * Gets the data in a buffer as a @c cxmutstr. + * + * @param buffer the buffer + * @return the data in the buffer interpreted as a @c cxmutstr + */ +CX_INLINE cxmutstr cx_bstr_m(CxBuffer *buffer) { + return cx_mutstrn(buffer->space, buffer->size); +} + #ifdef __cplusplus } #endif