Luna/libluna/include/luna/Format.h
apio 3a2e5b7ce0
All checks were successful
continuous-integration/drone/push Build is passing
luna: Adjust cstyle_format's description
2023-03-02 13:40:42 +01:00

17 lines
718 B
C

#pragma once
#include <luna/Attributes.h>
#include <luna/Result.h>
#include <stdarg.h>
typedef Result<void> (*callback_t)(char, void*);
// Format output according to a format string and a list of variadic arguments. callback is called with arg for every
// character in the resulting string.
Result<usize> cstyle_format(const char* format, callback_t callback, void* arg, va_list ap);
// Convenience function which outputs into a fixed-size buffer (not unlike vsnprintf)
usize vstring_format(char* buf, usize max, const char* format, va_list ap);
// Convenience function which outputs into a fixed-size buffer (not unlike snprintf)
usize string_format(char* buf, usize max, const char* format, ...) _format(3, 4);