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
CnxFormatContextis the context type used to store parsed format specifier state for passing to the formatting functionsCnxFormat.formatandCnxFormat.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
CnxFormatContextis the context type used to store parsed format specifier state for passing to the formatting functionsCnxFormat.formatandCnxFormat.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_validfor the builtincstring - CnxFormatContext cnx_format_is_specifier_valid_bool(const CnxFormat*restrict self, CnxStringView specifier)
- implementation of
CnxFormat.is_specifier_validfor the builtinbool - CnxFormatContext cnx_format_is_specifier_valid_char(const CnxFormat*restrict self, CnxStringView specifier)
- implementation of
CnxFormat.is_specifier_validfor the builtinchar - CnxFormatContext cnx_format_is_specifier_valid_u8(const CnxFormat*restrict self, CnxStringView specifier)
- implementation of
CnxFormat.is_specifier_validfor the builtinu8 - CnxFormatContext cnx_format_is_specifier_valid_u16(const CnxFormat*restrict self, CnxStringView specifier)
- implementation of
CnxFormat.is_specifier_validfor the builtinu16 - CnxFormatContext cnx_format_is_specifier_valid_u32(const CnxFormat*restrict self, CnxStringView specifier)
- implementation of
CnxFormat.is_specifier_validfor the builtinu32 - CnxFormatContext cnx_format_is_specifier_valid_u64(const CnxFormat*restrict self, CnxStringView specifier)
- implementation of
CnxFormat.is_specifier_validfor the builtinu64 - CnxFormatContext cnx_format_is_specifier_valid_i8(const CnxFormat*restrict self, CnxStringView specifier)
- implementation of
CnxFormat.is_specifier_validfor the builtini8 - CnxFormatContext cnx_format_is_specifier_valid_i16(const CnxFormat*restrict self, CnxStringView specifier)
- implementation of
CnxFormat.is_specifier_validfor the builtini16 - CnxFormatContext cnx_format_is_specifier_valid_i32(const CnxFormat*restrict self, CnxStringView specifier)
- implementation of
CnxFormat.is_specifier_validfor the builtini32 - CnxFormatContext cnx_format_is_specifier_valid_i64(const CnxFormat*restrict self, CnxStringView specifier)
- implementation of
CnxFormat.is_specifier_validfor the builtini64 - CnxFormatContext cnx_format_is_specifier_valid_f32(const CnxFormat*restrict self, CnxStringView specifier)
- implementation of
CnxFormat.is_specifier_validfor the builtinf32 - CnxFormatContext cnx_format_is_specifier_valid_f64(const CnxFormat*restrict self, CnxStringView specifier)
- implementation of
CnxFormat.is_specifier_validfor the builtinf64 - CnxFormatContext cnx_format_is_specifier_valid_ptr(const CnxFormat*restrict self, CnxStringView specifier)
- implementation of
CnxFormat.is_specifier_validfor pointers - CnxFormatContext cnx_format_is_specifier_valid_cnx_string(const CnxFormat*restrict self, CnxStringView specifier)
- implementation of
CnxFormat.is_specifier_validforCnxString - CnxFormatContext cnx_format_is_specifier_valid_cnx_stringview(const CnxFormat*restrict self, CnxStringView specifier)
- implementation of
CnxFormat.is_specifier_validforCnxStringView - CnxString cnx_format_cstring(const CnxFormat*restrict self, CnxFormatContext context)
- implementation of
CnxFormat.formatfor the builtincstring - CnxString cnx_format_bool(const CnxFormat*restrict self, CnxFormatContext context)
- implementation of
CnxFormat.formatfor the builtinbool - CnxString cnx_format_char(const CnxFormat*restrict self, CnxFormatContext context)
- implementation of
CnxFormat.formatfor the builtinchar - CnxString cnx_format_u8(const CnxFormat*restrict self, CnxFormatContext context)
- implementation of
CnxFormat.formatfor the builtinu8 - CnxString cnx_format_u16(const CnxFormat*restrict self, CnxFormatContext context)
- implementation of
CnxFormat.formatfor the builtinu16 - CnxString cnx_format_u32(const CnxFormat*restrict self, CnxFormatContext context)
- implementation of
CnxFormat.formatfor the builtinu32 - CnxString cnx_format_u64(const CnxFormat*restrict self, CnxFormatContext context)
- implementation of
CnxFormat.formatfor the builtinu64 - CnxString cnx_format_i8(const CnxFormat*restrict self, CnxFormatContext context)
- implementation of
CnxFormat.formatfor the builtini8 - CnxString cnx_format_i16(const CnxFormat*restrict self, CnxFormatContext context)
- implementation of
CnxFormat.formatfor the builtini16 - CnxString cnx_format_i32(const CnxFormat*restrict self, CnxFormatContext context)
- implementation of
CnxFormat.formatfor the builtini32 - CnxString cnx_format_i64(const CnxFormat*restrict self, CnxFormatContext context)
- implementation of
CnxFormat.formatfor the builtini64 - CnxString cnx_format_f32(const CnxFormat*restrict self, CnxFormatContext context)
- implementation of
CnxFormat.formatfor the builtinf32 - CnxString cnx_format_f64(const CnxFormat*restrict self, CnxFormatContext context)
- implementation of
CnxFormat.formatfor the builtinf64 - CnxString cnx_format_ptr(const CnxFormat*restrict self, CnxFormatContext context)
- implementation of
CnxFormat.formatfor pointers - CnxString cnx_format_cnx_string(const CnxFormat*restrict self, CnxFormatContext context)
- implementation of
CnxFormat.formatforCnxString - CnxString cnx_format_cnx_stringview(const CnxFormat*restrict self, CnxFormatContext context)
- implementation of
CnxFormat.formatforCnxStringView - CnxString cnx_format_cstring_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)
- implementation of
CnxFormat.format_with_allocatorfor the builtincstring - CnxString cnx_format_bool_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)
- implementation of
CnxFormat.format_with_allocatorfor the builtinbool - CnxString cnx_format_char_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)
- implementation of
CnxFormat.format_with_allocatorfor the builtinchar - CnxString cnx_format_u8_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)
- implementation of
CnxFormat.format_with_allocatorfor the builtinu8 - CnxString cnx_format_u16_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)
- implementation of
CnxFormat.format_with_allocatorfor the builtinu16 - CnxString cnx_format_u32_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)
- implementation of
CnxFormat.format_with_allocatorfor the builtinu32 - CnxString cnx_format_u64_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)
- implementation of
CnxFormat.format_with_allocatorfor the builtinu64 - CnxString cnx_format_i8_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)
- implementation of
CnxFormat.format_with_allocatorfor the builtini8 - CnxString cnx_format_i16_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)
- implementation of
CnxFormat.format_with_allocatorfor the builtini16 - CnxString cnx_format_i32_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)
- implementation of
CnxFormat.format_with_allocatorfor the builtini32 - CnxString cnx_format_i64_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)
- implementation of
CnxFormat.format_with_allocatorfor the builtini64 - CnxString cnx_format_f32_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)
- implementation of
CnxFormat.format_with_allocatorfor the builtinf32 - CnxString cnx_format_f64_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)
- implementation of
CnxFormat.format_with_allocatorfor the builtinf64 - CnxString cnx_format_ptr_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)
- implementation of
CnxFormat.format_with_allocatorfor pointers - CnxString cnx_format_cnx_string_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)
- implementation of
CnxFormat.format_with_allocatorforCnxString - CnxString cnx_format_cnx_stringview_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)
- implementation of
CnxFormat.format_with_allocatorforCnxStringView -
static ImplTraitFor(CnxFormat,
cstring,
cnx_
format_ is_ specifier_ valid_ cstring, cnx_ format_ cstring, cnx_ format_ cstring_ with_ allocator) - implementation of
CnxFormatfor the builtincstring -
static ImplTraitFor(CnxFormat,
bool,
cnx_
format_ is_ specifier_ valid_ bool, cnx_ format_ bool, cnx_ format_ bool_ with_ allocator) - implementation of
CnxFormatfor the builtinbool -
static ImplTraitFor(CnxFormat,
char,
cnx_
format_ is_ specifier_ valid_ char, cnx_ format_ char, cnx_ format_ char_ with_ allocator) - implementation of
CnxFormatfor the builtinchar -
static ImplTraitFor(CnxFormat,
u8,
cnx_
format_ is_ specifier_ valid_ u8, cnx_ format_ u8, cnx_ format_ u8_ with_ allocator) - implementation of
CnxFormatfor the builtinu8 -
static ImplTraitFor(CnxFormat,
u16,
cnx_
format_ is_ specifier_ valid_ u16, cnx_ format_ u16, cnx_ format_ u16_ with_ allocator) - implementation of
CnxFormatfor the builtinu16 -
static ImplTraitFor(CnxFormat,
u32,
cnx_
format_ is_ specifier_ valid_ u32, cnx_ format_ u32, cnx_ format_ u32_ with_ allocator) - implementation of
CnxFormatfor the builtinu32 -
static ImplTraitFor(CnxFormat,
u64,
cnx_
format_ is_ specifier_ valid_ u64, cnx_ format_ u64, cnx_ format_ u64_ with_ allocator) - implementation of
CnxFormatfor the builtinu64 -
static ImplTraitFor(CnxFormat,
i8,
cnx_
format_ is_ specifier_ valid_ i8, cnx_ format_ i8, cnx_ format_ i8_ with_ allocator) - implementation of
CnxFormatfor the builtini8 -
static ImplTraitFor(CnxFormat,
i16,
cnx_
format_ is_ specifier_ valid_ i16, cnx_ format_ i16, cnx_ format_ i16_ with_ allocator) - implementation of
CnxFormatfor the builtini16 -
static ImplTraitFor(CnxFormat,
i32,
cnx_
format_ is_ specifier_ valid_ i32, cnx_ format_ i32, cnx_ format_ i32_ with_ allocator) - implementation of
CnxFormatfor the builtini32 -
static ImplTraitFor(CnxFormat,
i64,
cnx_
format_ is_ specifier_ valid_ i64, cnx_ format_ i64, cnx_ format_ i64_ with_ allocator) - implementation of
CnxFormatfor the builtini64 -
static ImplTraitFor(CnxFormat,
f32,
cnx_
format_ is_ specifier_ valid_ f32, cnx_ format_ f32, cnx_ format_ f32_ with_ allocator) - implementation of
CnxFormatfor the builtinf32 -
static ImplTraitFor(CnxFormat,
f64,
cnx_
format_ is_ specifier_ valid_ f64, cnx_ format_ f64, cnx_ format_ f64_ with_ allocator) - implementation of
CnxFormatfor the builtinf64 -
static ImplTraitFor(CnxFormat,
nullptr_
t, cnx_ format_ is_ specifier_ valid_ ptr, cnx_ format_ ptr, cnx_ format_ ptr_ with_ allocator) - implementation of
CnxFormatfor pointers -
static ImplTraitFor(CnxFormat,
CnxString,
cnx_
format_ is_ specifier_ valid_ cnx_ string, cnx_ format_ cnx_ string, cnx_ format_ cnx_ string_ with_ allocator) - implementation of
CnxFormatforCnxString -
static ImplTraitFor(CnxFormat,
CnxStringView,
cnx_
format_ is_ specifier_ valid_ cnx_ stringview, cnx_ format_ cnx_ stringview, cnx_ format_ cnx_ stringview_ with_ allocator) - implementation of
CnxFormatforCnxStringView
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
CnxFormatTrait implementation. - #define CNX_AS_FORMAT_USES_USER_SUPPLIED_TYPES
- Feature enable macro to allow specific user-defined types to be automatically converted to their
CnxFormatimplementation when passed tocnx_or a similar Cnx string formatting function.format(format_ string, ...) - #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
CnxFormatimplementation when passed tocnx_or a similar Cnx string formatting function.format(format_ string, ...) - #define as_format(x)
- Converts the given variable into its associated
CnxFormatTrait 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_listparameter 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_listparameter 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 |
|---|
static ImplTraitFor(CnxFormat,
nullptr_ t,
cnx_ format_ is_ specifier_ valid_ ptr,
cnx_ format_ ptr,
cnx_ format_ ptr_ with_ allocator)
implementation of CnxFormat for pointers
| Returns | The CnxFormat implementation |
|---|
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
| Returns | The CnxFormat implementation |
|---|
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
| Returns | The CnxFormat implementation |
|---|