include/Cnx/Format.h file

CnxFormat brings human readable string formatting, similar to C++'s std::format and fmtlib, and Rust's std::format, to C.

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Classes

struct CnxFormatContext
CnxFormatContext is the context type used to store parsed format specifier state for passing to the formatting functions CnxFormat.format and CnxFormat.format_with_allocator.

Enums

enum CnxFormatErrorTypes { CNX_FORMAT_SUCCESS = 0, CNX_FORMAT_BAD_SPECIFIER_INVALID_CHAR_IN_SPECIFIER, CNX_FORMAT_INVALID_CLOSING_BRACE_LOCATION, CNX_FORMAT_UNCLOSED_SPECIFIER, CNX_FORMAT_MORE_SPECIFIERS_THAN_ARGS, CNX_FORMAT_FEWER_SPECIFIERS_THAN_ARGS }
Specifies possible errors that could occur when parsing a format specifier.
enum CnxFormatDefaults { CNX_FORMAT_DEFAULT_NUM_SIG_FIGS = 3 }
Default values for various formatting parameters for Cnx string formatting.

Typedefs

using CnxFormatErrorTypes = enum CnxFormatErrorTypes
Specifies possible errors that could occur when parsing a format specifier.
using CnxFormatContext = struct CnxFormatContext
CnxFormatContext is the context type used to store parsed format specifier state for passing to the formatting functions CnxFormat.format and CnxFormat.format_with_allocator.
using CnxFormatDefaults = enum CnxFormatDefaults
Default values for various formatting parameters for Cnx string formatting.

Functions

CnxString cnx_format_with_allocator(restrict const_cstring format_string, CnxAllocator allocator, usize num_args, ...) cnx_disable_if(!format_string
Formats the various parameter pack arguments into their associated place in the given format string, using the provided allocator.
CnxString cnx_vformat_with_allocator(restrict const_cstring format_string, CnxAllocator allocator, usize num_args, va_list list) cnx_disable_if(!format_string
Formats the various parameter pack arguments into their associated place in the given format string, using the provided allocator.
CnxFormatContext cnx_format_is_specifier_valid_cstring(const CnxFormat*restrict self, CnxStringView specifier)
implementation of CnxFormat.is_specifier_valid for the builtin cstring
CnxFormatContext cnx_format_is_specifier_valid_bool(const CnxFormat*restrict self, CnxStringView specifier)
implementation of CnxFormat.is_specifier_valid for the builtin bool
CnxFormatContext cnx_format_is_specifier_valid_char(const CnxFormat*restrict self, CnxStringView specifier)
implementation of CnxFormat.is_specifier_valid for the builtin char
CnxFormatContext cnx_format_is_specifier_valid_u8(const CnxFormat*restrict self, CnxStringView specifier)
implementation of CnxFormat.is_specifier_valid for the builtin u8
CnxFormatContext cnx_format_is_specifier_valid_u16(const CnxFormat*restrict self, CnxStringView specifier)
implementation of CnxFormat.is_specifier_valid for the builtin u16
CnxFormatContext cnx_format_is_specifier_valid_u32(const CnxFormat*restrict self, CnxStringView specifier)
implementation of CnxFormat.is_specifier_valid for the builtin u32
CnxFormatContext cnx_format_is_specifier_valid_u64(const CnxFormat*restrict self, CnxStringView specifier)
implementation of CnxFormat.is_specifier_valid for the builtin u64
CnxFormatContext cnx_format_is_specifier_valid_i8(const CnxFormat*restrict self, CnxStringView specifier)
implementation of CnxFormat.is_specifier_valid for the builtin i8
CnxFormatContext cnx_format_is_specifier_valid_i16(const CnxFormat*restrict self, CnxStringView specifier)
implementation of CnxFormat.is_specifier_valid for the builtin i16
CnxFormatContext cnx_format_is_specifier_valid_i32(const CnxFormat*restrict self, CnxStringView specifier)
implementation of CnxFormat.is_specifier_valid for the builtin i32
CnxFormatContext cnx_format_is_specifier_valid_i64(const CnxFormat*restrict self, CnxStringView specifier)
implementation of CnxFormat.is_specifier_valid for the builtin i64
CnxFormatContext cnx_format_is_specifier_valid_f32(const CnxFormat*restrict self, CnxStringView specifier)
implementation of CnxFormat.is_specifier_valid for the builtin f32
CnxFormatContext cnx_format_is_specifier_valid_f64(const CnxFormat*restrict self, CnxStringView specifier)
implementation of CnxFormat.is_specifier_valid for the builtin f64
CnxFormatContext cnx_format_is_specifier_valid_ptr(const CnxFormat*restrict self, CnxStringView specifier)
implementation of CnxFormat.is_specifier_valid for pointers
CnxFormatContext cnx_format_is_specifier_valid_cnx_string(const CnxFormat*restrict self, CnxStringView specifier)
implementation of CnxFormat.is_specifier_valid for CnxString
CnxFormatContext cnx_format_is_specifier_valid_cnx_stringview(const CnxFormat*restrict self, CnxStringView specifier)
implementation of CnxFormat.is_specifier_valid for CnxStringView
CnxString cnx_format_cstring(const CnxFormat*restrict self, CnxFormatContext context)
implementation of CnxFormat.format for the builtin cstring
CnxString cnx_format_bool(const CnxFormat*restrict self, CnxFormatContext context)
implementation of CnxFormat.format for the builtin bool
CnxString cnx_format_char(const CnxFormat*restrict self, CnxFormatContext context)
implementation of CnxFormat.format for the builtin char
CnxString cnx_format_u8(const CnxFormat*restrict self, CnxFormatContext context)
implementation of CnxFormat.format for the builtin u8
CnxString cnx_format_u16(const CnxFormat*restrict self, CnxFormatContext context)
implementation of CnxFormat.format for the builtin u16
CnxString cnx_format_u32(const CnxFormat*restrict self, CnxFormatContext context)
implementation of CnxFormat.format for the builtin u32
CnxString cnx_format_u64(const CnxFormat*restrict self, CnxFormatContext context)
implementation of CnxFormat.format for the builtin u64
CnxString cnx_format_i8(const CnxFormat*restrict self, CnxFormatContext context)
implementation of CnxFormat.format for the builtin i8
CnxString cnx_format_i16(const CnxFormat*restrict self, CnxFormatContext context)
implementation of CnxFormat.format for the builtin i16
CnxString cnx_format_i32(const CnxFormat*restrict self, CnxFormatContext context)
implementation of CnxFormat.format for the builtin i32
CnxString cnx_format_i64(const CnxFormat*restrict self, CnxFormatContext context)
implementation of CnxFormat.format for the builtin i64
CnxString cnx_format_f32(const CnxFormat*restrict self, CnxFormatContext context)
implementation of CnxFormat.format for the builtin f32
CnxString cnx_format_f64(const CnxFormat*restrict self, CnxFormatContext context)
implementation of CnxFormat.format for the builtin f64
CnxString cnx_format_ptr(const CnxFormat*restrict self, CnxFormatContext context)
implementation of CnxFormat.format for pointers
CnxString cnx_format_cnx_string(const CnxFormat*restrict self, CnxFormatContext context)
implementation of CnxFormat.format for CnxString
CnxString cnx_format_cnx_stringview(const CnxFormat*restrict self, CnxFormatContext context)
implementation of CnxFormat.format for CnxStringView
CnxString cnx_format_cstring_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)
implementation of CnxFormat.format_with_allocator for the builtin cstring
CnxString cnx_format_bool_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)
implementation of CnxFormat.format_with_allocator for the builtin bool
CnxString cnx_format_char_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)
implementation of CnxFormat.format_with_allocator for the builtin char
CnxString cnx_format_u8_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)
implementation of CnxFormat.format_with_allocator for the builtin u8
CnxString cnx_format_u16_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)
implementation of CnxFormat.format_with_allocator for the builtin u16
CnxString cnx_format_u32_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)
implementation of CnxFormat.format_with_allocator for the builtin u32
CnxString cnx_format_u64_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)
implementation of CnxFormat.format_with_allocator for the builtin u64
CnxString cnx_format_i8_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)
implementation of CnxFormat.format_with_allocator for the builtin i8
CnxString cnx_format_i16_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)
implementation of CnxFormat.format_with_allocator for the builtin i16
CnxString cnx_format_i32_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)
implementation of CnxFormat.format_with_allocator for the builtin i32
CnxString cnx_format_i64_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)
implementation of CnxFormat.format_with_allocator for the builtin i64
CnxString cnx_format_f32_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)
implementation of CnxFormat.format_with_allocator for the builtin f32
CnxString cnx_format_f64_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)
implementation of CnxFormat.format_with_allocator for the builtin f64
CnxString cnx_format_ptr_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)
implementation of CnxFormat.format_with_allocator for pointers
CnxString cnx_format_cnx_string_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)
implementation of CnxFormat.format_with_allocator for CnxString
CnxString cnx_format_cnx_stringview_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)
implementation of CnxFormat.format_with_allocator for CnxStringView
static ImplTraitFor(CnxFormat, cstring, cnx_format_is_specifier_valid_cstring, cnx_format_cstring, cnx_format_cstring_with_allocator)
implementation of CnxFormat for the builtin cstring
static ImplTraitFor(CnxFormat, bool, cnx_format_is_specifier_valid_bool, cnx_format_bool, cnx_format_bool_with_allocator)
implementation of CnxFormat for the builtin bool
static ImplTraitFor(CnxFormat, char, cnx_format_is_specifier_valid_char, cnx_format_char, cnx_format_char_with_allocator)
implementation of CnxFormat for the builtin char
static ImplTraitFor(CnxFormat, u8, cnx_format_is_specifier_valid_u8, cnx_format_u8, cnx_format_u8_with_allocator)
implementation of CnxFormat for the builtin u8
static ImplTraitFor(CnxFormat, u16, cnx_format_is_specifier_valid_u16, cnx_format_u16, cnx_format_u16_with_allocator)
implementation of CnxFormat for the builtin u16
static ImplTraitFor(CnxFormat, u32, cnx_format_is_specifier_valid_u32, cnx_format_u32, cnx_format_u32_with_allocator)
implementation of CnxFormat for the builtin u32
static ImplTraitFor(CnxFormat, u64, cnx_format_is_specifier_valid_u64, cnx_format_u64, cnx_format_u64_with_allocator)
implementation of CnxFormat for the builtin u64
static ImplTraitFor(CnxFormat, i8, cnx_format_is_specifier_valid_i8, cnx_format_i8, cnx_format_i8_with_allocator)
implementation of CnxFormat for the builtin i8
static ImplTraitFor(CnxFormat, i16, cnx_format_is_specifier_valid_i16, cnx_format_i16, cnx_format_i16_with_allocator)
implementation of CnxFormat for the builtin i16
static ImplTraitFor(CnxFormat, i32, cnx_format_is_specifier_valid_i32, cnx_format_i32, cnx_format_i32_with_allocator)
implementation of CnxFormat for the builtin i32
static ImplTraitFor(CnxFormat, i64, cnx_format_is_specifier_valid_i64, cnx_format_i64, cnx_format_i64_with_allocator)
implementation of CnxFormat for the builtin i64
static ImplTraitFor(CnxFormat, f32, cnx_format_is_specifier_valid_f32, cnx_format_f32, cnx_format_f32_with_allocator)
implementation of CnxFormat for the builtin f32
static ImplTraitFor(CnxFormat, f64, cnx_format_is_specifier_valid_f64, cnx_format_f64, cnx_format_f64_with_allocator)
implementation of CnxFormat for the builtin f64
static ImplTraitFor(CnxFormat, nullptr_t, cnx_format_is_specifier_valid_ptr, cnx_format_ptr, cnx_format_ptr_with_allocator)
implementation of CnxFormat for pointers
static ImplTraitFor(CnxFormat, CnxString, cnx_format_is_specifier_valid_cnx_string, cnx_format_cnx_string, cnx_format_cnx_string_with_allocator)
implementation of CnxFormat for CnxString
static ImplTraitFor(CnxFormat, CnxStringView, cnx_format_is_specifier_valid_cnx_stringview, cnx_format_cnx_stringview, cnx_format_cnx_stringview_with_allocator)
implementation of CnxFormat for CnxStringView

Defines

#define CNX_FORMAT
Declarations and Definitions related to cnx_format(format_string, ...), CnxFormat, and Cnx string formatting.
#define as_format_t(T, x)
Converts the given variable into its associated CnxFormat Trait implementation.
#define CNX_AS_FORMAT_USES_USER_SUPPLIED_TYPES
Feature enable macro to allow specific user-defined types to be automatically converted to their CnxFormat implementation when passed to cnx_format(format_string, ...) or a similar Cnx string formatting function.
#define CNX_AS_FORMAT_USER_SUPPLIED_TYPES
Define this macro to a comma separated list of conversions to enable specific user-defined types to be automatically converted to their CnxFormat implementation when passed to cnx_format(format_string, ...) or a similar Cnx string formatting function.
#define as_format(x)
Converts the given variable into its associated CnxFormat Trait implementation.
#define cnx_format_with_allocator(format_string, allocator, ...)
Formats the various parameter pack arguments into their associated place in the given format string, using the provided allocator.
#define cnx_format(format_string, ...)
Formats the various parameter pack arguments into their associated place in the given format string, using the default allocator.
#define cnx_vformat_with_allocator(format_string, allocator, num_args, list)
Formats the various va_list parameter pack arguments into their associated place in the given format string, using the provided allocator.
#define cnx_vformat(format_string, num_args, list)
Formats the various va_list parameter pack arguments into their associated place in the given format string, using the default allocator.

Function documentation

CnxString cnx_format_with_allocator(restrict const_cstring format_string, CnxAllocator allocator, usize num_args, ...) cnx_disable_if(!format_string

Formats the various parameter pack arguments into their associated place in the given format string, using the provided allocator.

Parameters
format_string - The string specifying the format positions, specifiers, and other text that should be present in the output string
allocator - The CnxAllocator to allocate the output string with
num_args - The number of arguments in the parameter pack
Returns The formatted output string

CnxString cnx_vformat_with_allocator(restrict const_cstring format_string, CnxAllocator allocator, usize num_args, va_list list) cnx_disable_if(!format_string

Formats the various parameter pack arguments into their associated place in the given format string, using the provided allocator.

Parameters
format_string - The string specifying the format positions, specifiers, and other text that should be present in the output string
allocator - The CnxAllocator to allocate the output string with
num_args - The number of arguments in the parameter pack
list - The parameter pack of arguments to be formatted
Returns The formatted output string

CnxFormatContext cnx_format_is_specifier_valid_cstring(const CnxFormat*restrict self, CnxStringView specifier)

implementation of CnxFormat.is_specifier_valid for the builtin cstring

Parameters
self - The CnxFormat Trait object to format
specifier - The format specifier to follow
Returns whether specifier is valid

CnxFormatContext cnx_format_is_specifier_valid_bool(const CnxFormat*restrict self, CnxStringView specifier)

implementation of CnxFormat.is_specifier_valid for the builtin bool

Parameters
self - The CnxFormat Trait object to format
specifier - The format specifier to follow
Returns whether specifier is valid

CnxFormatContext cnx_format_is_specifier_valid_char(const CnxFormat*restrict self, CnxStringView specifier)

implementation of CnxFormat.is_specifier_valid for the builtin char

Parameters
self - The CnxFormat Trait object to format
specifier - The format specifier to follow
Returns whether specifier is valid

CnxFormatContext cnx_format_is_specifier_valid_u8(const CnxFormat*restrict self, CnxStringView specifier)

implementation of CnxFormat.is_specifier_valid for the builtin u8

Parameters
self - The CnxFormat Trait object to format
specifier - The format specifier to follow
Returns whether specifier is valid

CnxFormatContext cnx_format_is_specifier_valid_u16(const CnxFormat*restrict self, CnxStringView specifier)

implementation of CnxFormat.is_specifier_valid for the builtin u16

Parameters
self - The CnxFormat Trait object to format
specifier - The format specifier to follow
Returns whether specifier is valid

CnxFormatContext cnx_format_is_specifier_valid_u32(const CnxFormat*restrict self, CnxStringView specifier)

implementation of CnxFormat.is_specifier_valid for the builtin u32

Parameters
self - The CnxFormat Trait object to format
specifier - The format specifier to follow
Returns whether specifier is valid

CnxFormatContext cnx_format_is_specifier_valid_u64(const CnxFormat*restrict self, CnxStringView specifier)

implementation of CnxFormat.is_specifier_valid for the builtin u64

Parameters
self - The CnxFormat Trait object to format
specifier - The format specifier to follow
Returns whether specifier is valid

CnxFormatContext cnx_format_is_specifier_valid_i8(const CnxFormat*restrict self, CnxStringView specifier)

implementation of CnxFormat.is_specifier_valid for the builtin i8

Parameters
self - The CnxFormat Trait object to format
specifier - The format specifier to follow
Returns whether specifier is valid

CnxFormatContext cnx_format_is_specifier_valid_i16(const CnxFormat*restrict self, CnxStringView specifier)

implementation of CnxFormat.is_specifier_valid for the builtin i16

Parameters
self - The CnxFormat Trait object to format
specifier - The format specifier to follow
Returns whether specifier is valid

CnxFormatContext cnx_format_is_specifier_valid_i32(const CnxFormat*restrict self, CnxStringView specifier)

implementation of CnxFormat.is_specifier_valid for the builtin i32

Parameters
self - The CnxFormat Trait object to format
specifier - The format specifier to follow
Returns whether specifier is valid

CnxFormatContext cnx_format_is_specifier_valid_i64(const CnxFormat*restrict self, CnxStringView specifier)

implementation of CnxFormat.is_specifier_valid for the builtin i64

Parameters
self - The CnxFormat Trait object to format
specifier - The format specifier to follow
Returns whether specifier is valid

CnxFormatContext cnx_format_is_specifier_valid_f32(const CnxFormat*restrict self, CnxStringView specifier)

implementation of CnxFormat.is_specifier_valid for the builtin f32

Parameters
self - The CnxFormat Trait object to format
specifier - The format specifier to follow
Returns whether specifier is valid

CnxFormatContext cnx_format_is_specifier_valid_f64(const CnxFormat*restrict self, CnxStringView specifier)

implementation of CnxFormat.is_specifier_valid for the builtin f64

Parameters
self - The CnxFormat Trait object to format
specifier - The format specifier to follow
Returns whether specifier is valid

CnxFormatContext cnx_format_is_specifier_valid_ptr(const CnxFormat*restrict self, CnxStringView specifier)

implementation of CnxFormat.is_specifier_valid for pointers

Parameters
self - The CnxFormat Trait object to format
specifier - The format specifier to follow
Returns whether specifier is valid

CnxFormatContext cnx_format_is_specifier_valid_cnx_string(const CnxFormat*restrict self, CnxStringView specifier)

implementation of CnxFormat.is_specifier_valid for CnxString

Parameters
self - The CnxFormat Trait object to format
specifier - The format specifier to follow
Returns whether specifier is valid

CnxFormatContext cnx_format_is_specifier_valid_cnx_stringview(const CnxFormat*restrict self, CnxStringView specifier)

implementation of CnxFormat.is_specifier_valid for CnxStringView

Parameters
self - The CnxFormat Trait object to format
specifier - The format specifier to follow
Returns whether specifier is valid

CnxString cnx_format_cstring(const CnxFormat*restrict self, CnxFormatContext context)

implementation of CnxFormat.format for the builtin cstring

Parameters
self - The CnxFormat Trait object to format
context - The format specifier to follow
Returns a formatted string associated with self

CnxString cnx_format_bool(const CnxFormat*restrict self, CnxFormatContext context)

implementation of CnxFormat.format for the builtin bool

Parameters
self - The CnxFormat Trait object to format
context - The format specifier to follow
Returns a formatted string associated with self

CnxString cnx_format_char(const CnxFormat*restrict self, CnxFormatContext context)

implementation of CnxFormat.format for the builtin char

Parameters
self - The CnxFormat Trait object to format
context - The format specifier to follow
Returns a formatted string associated with self

CnxString cnx_format_u8(const CnxFormat*restrict self, CnxFormatContext context)

implementation of CnxFormat.format for the builtin u8

Parameters
self - The CnxFormat Trait object to format
context - The format specifier to follow
Returns a formatted string associated with self

CnxString cnx_format_u16(const CnxFormat*restrict self, CnxFormatContext context)

implementation of CnxFormat.format for the builtin u16

Parameters
self - The CnxFormat Trait object to format
context - The format specifier to follow
Returns a formatted string associated with self

CnxString cnx_format_u32(const CnxFormat*restrict self, CnxFormatContext context)

implementation of CnxFormat.format for the builtin u32

Parameters
self - The CnxFormat Trait object to format
context - The format specifier to follow
Returns a formatted string associated with self

CnxString cnx_format_u64(const CnxFormat*restrict self, CnxFormatContext context)

implementation of CnxFormat.format for the builtin u64

Parameters
self - The CnxFormat Trait object to format
context - The format specifier to follow
Returns a formatted string associated with self

CnxString cnx_format_i8(const CnxFormat*restrict self, CnxFormatContext context)

implementation of CnxFormat.format for the builtin i8

Parameters
self - The CnxFormat Trait object to format
context - The format specifier to follow
Returns a formatted string associated with self

CnxString cnx_format_i16(const CnxFormat*restrict self, CnxFormatContext context)

implementation of CnxFormat.format for the builtin i16

Parameters
self - The CnxFormat Trait object to format
context - The format specifier to follow
Returns a formatted string associated with self

CnxString cnx_format_i32(const CnxFormat*restrict self, CnxFormatContext context)

implementation of CnxFormat.format for the builtin i32

Parameters
self - The CnxFormat Trait object to format
context - The format specifier to follow
Returns a formatted string associated with self

CnxString cnx_format_i64(const CnxFormat*restrict self, CnxFormatContext context)

implementation of CnxFormat.format for the builtin i64

Parameters
self - The CnxFormat Trait object to format
context - The format specifier to follow
Returns a formatted string associated with self

CnxString cnx_format_f32(const CnxFormat*restrict self, CnxFormatContext context)

implementation of CnxFormat.format for the builtin f32

Parameters
self - The CnxFormat Trait object to format
context - The format specifier to follow
Returns a formatted string associated with self

CnxString cnx_format_f64(const CnxFormat*restrict self, CnxFormatContext context)

implementation of CnxFormat.format for the builtin f64

Parameters
self - The CnxFormat Trait object to format
context - The format specifier to follow
Returns a formatted string associated with self

CnxString cnx_format_ptr(const CnxFormat*restrict self, CnxFormatContext context)

implementation of CnxFormat.format for pointers

Parameters
self - The CnxFormat Trait object to format
context - The format specifier to follow
Returns a formatted string associated with self

CnxString cnx_format_cnx_string(const CnxFormat*restrict self, CnxFormatContext context)

implementation of CnxFormat.format for CnxString

Parameters
self - The CnxFormat Trait object to format
context - The format specifier to follow
Returns a formatted string associated with self

CnxString cnx_format_cnx_stringview(const CnxFormat*restrict self, CnxFormatContext context)

implementation of CnxFormat.format for CnxStringView

Parameters
self - The CnxFormat Trait object to format
context - The format specifier to follow
Returns a formatted string associated with self

CnxString cnx_format_cstring_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)

implementation of CnxFormat.format_with_allocator for the builtin cstring

Parameters
self - The CnxFormat Trait object to format
context - The format specifier to follow
allocator - The CnxAllocator to allocate the format string with
Returns a formatted string associated with self

CnxString cnx_format_bool_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)

implementation of CnxFormat.format_with_allocator for the builtin bool

Parameters
self - The CnxFormat Trait object to format
context - The format specifier to follow
allocator - The CnxAllocator to allocate the format string with
Returns a formatted string associated with self

CnxString cnx_format_char_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)

implementation of CnxFormat.format_with_allocator for the builtin char

Parameters
self - The CnxFormat Trait object to format
context - The format specifier to follow
allocator - The CnxAllocator to allocate the format string with
Returns a formatted string associated with self

CnxString cnx_format_u8_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)

implementation of CnxFormat.format_with_allocator for the builtin u8

Parameters
self - The CnxFormat Trait object to format
context - The format specifier to follow
allocator - The CnxAllocator to allocate the format string with
Returns a formatted string associated with self

CnxString cnx_format_u16_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)

implementation of CnxFormat.format_with_allocator for the builtin u16

Parameters
self - The CnxFormat Trait object to format
context - The format specifier to follow
allocator - The CnxAllocator to allocate the format string with
Returns a formatted string associated with self

CnxString cnx_format_u32_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)

implementation of CnxFormat.format_with_allocator for the builtin u32

Parameters
self - The CnxFormat Trait object to format
context - The format specifier to follow
allocator - The CnxAllocator to allocate the format string with
Returns a formatted string associated with self

CnxString cnx_format_u64_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)

implementation of CnxFormat.format_with_allocator for the builtin u64

Parameters
self - The CnxFormat Trait object to format
context - The format specifier to follow
allocator - The CnxAllocator to allocate the format string with
Returns a formatted string associated with self

CnxString cnx_format_i8_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)

implementation of CnxFormat.format_with_allocator for the builtin i8

Parameters
self - The CnxFormat Trait object to format
context - The format specifier to follow
allocator - The CnxAllocator to allocate the format string with
Returns a formatted string associated with self

CnxString cnx_format_i16_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)

implementation of CnxFormat.format_with_allocator for the builtin i16

Parameters
self - The CnxFormat Trait object to format
context - The format specifier to follow
allocator - The CnxAllocator to allocate the format string with
Returns a formatted string associated with self

CnxString cnx_format_i32_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)

implementation of CnxFormat.format_with_allocator for the builtin i32

Parameters
self - The CnxFormat Trait object to format
context - The format specifier to follow
allocator - The CnxAllocator to allocate the format string with
Returns a formatted string associated with self

CnxString cnx_format_i64_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)

implementation of CnxFormat.format_with_allocator for the builtin i64

Parameters
self - The CnxFormat Trait object to format
context - The format specifier to follow
allocator - The CnxAllocator to allocate the format string with
Returns a formatted string associated with self

CnxString cnx_format_f32_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)

implementation of CnxFormat.format_with_allocator for the builtin f32

Parameters
self - The CnxFormat Trait object to format
context - The format specifier to follow
allocator - The CnxAllocator to allocate the format string with
Returns a formatted string associated with self

CnxString cnx_format_f64_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)

implementation of CnxFormat.format_with_allocator for the builtin f64

Parameters
self - The CnxFormat Trait object to format
context - The format specifier to follow
allocator - The CnxAllocator to allocate the format string with
Returns a formatted string associated with self

CnxString cnx_format_ptr_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)

implementation of CnxFormat.format_with_allocator for pointers

Parameters
self - The CnxFormat Trait object to format
context - The format specifier to follow
allocator - The CnxAllocator to allocate the format string with
Returns a formatted string associated with self

CnxString cnx_format_cnx_string_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)

implementation of CnxFormat.format_with_allocator for CnxString

Parameters
self - The CnxFormat Trait object to format
context - The format specifier to follow
allocator - The CnxAllocator to allocate the format string with
Returns a formatted string associated with self

CnxString cnx_format_cnx_stringview_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)

implementation of CnxFormat.format_with_allocator for CnxStringView

Parameters
self - The CnxFormat Trait object to format
context - The format specifier to follow
allocator - The CnxAllocator to allocate the format string with
Returns a formatted string associated with self

static ImplTraitFor(CnxFormat, cstring, cnx_format_is_specifier_valid_cstring, cnx_format_cstring, cnx_format_cstring_with_allocator)

implementation of CnxFormat for the builtin cstring

Returns The CnxFormat implementation

static ImplTraitFor(CnxFormat, bool, cnx_format_is_specifier_valid_bool, cnx_format_bool, cnx_format_bool_with_allocator)

implementation of CnxFormat for the builtin bool

Returns The CnxFormat implementation

static ImplTraitFor(CnxFormat, char, cnx_format_is_specifier_valid_char, cnx_format_char, cnx_format_char_with_allocator)

implementation of CnxFormat for the builtin char

Returns The CnxFormat implementation

static ImplTraitFor(CnxFormat, u8, cnx_format_is_specifier_valid_u8, cnx_format_u8, cnx_format_u8_with_allocator)

implementation of CnxFormat for the builtin u8

Returns The CnxFormat implementation

static ImplTraitFor(CnxFormat, u16, cnx_format_is_specifier_valid_u16, cnx_format_u16, cnx_format_u16_with_allocator)

implementation of CnxFormat for the builtin u16

Returns The CnxFormat implementation

static ImplTraitFor(CnxFormat, u32, cnx_format_is_specifier_valid_u32, cnx_format_u32, cnx_format_u32_with_allocator)

implementation of CnxFormat for the builtin u32

Returns The CnxFormat implementation

static ImplTraitFor(CnxFormat, u64, cnx_format_is_specifier_valid_u64, cnx_format_u64, cnx_format_u64_with_allocator)

implementation of CnxFormat for the builtin u64

Returns The CnxFormat implementation

static ImplTraitFor(CnxFormat, i8, cnx_format_is_specifier_valid_i8, cnx_format_i8, cnx_format_i8_with_allocator)

implementation of CnxFormat for the builtin i8

Returns The CnxFormat implementation

static ImplTraitFor(CnxFormat, i16, cnx_format_is_specifier_valid_i16, cnx_format_i16, cnx_format_i16_with_allocator)

implementation of CnxFormat for the builtin i16

Returns The CnxFormat implementation

static ImplTraitFor(CnxFormat, i32, cnx_format_is_specifier_valid_i32, cnx_format_i32, cnx_format_i32_with_allocator)

implementation of CnxFormat for the builtin i32

Returns The CnxFormat implementation

static ImplTraitFor(CnxFormat, i64, cnx_format_is_specifier_valid_i64, cnx_format_i64, cnx_format_i64_with_allocator)

implementation of CnxFormat for the builtin i64

Returns The CnxFormat implementation

static ImplTraitFor(CnxFormat, f32, cnx_format_is_specifier_valid_f32, cnx_format_f32, cnx_format_f32_with_allocator)

implementation of CnxFormat for the builtin f32

Returns The CnxFormat implementation

static ImplTraitFor(CnxFormat, f64, cnx_format_is_specifier_valid_f64, cnx_format_f64, cnx_format_f64_with_allocator)

implementation of CnxFormat for the builtin f64

Returns The CnxFormat implementation