Go to the documentation of this file.
26 #include <azure/core/_az_cfg_prefix.h>
69 #ifdef AZ_NO_PRECONDITION_CHECKING
72 return (
az_span){ ._internal = { .ptr = ptr, .size = size } };
76 #endif // AZ_NO_PRECONDITION_CHECKING
84 #define AZ_SPAN_LITERAL_EMPTY \
86 ._internal = {.ptr = NULL, .size = 0 } \
95 #define AZ_SPAN_EMPTY (az_span) AZ_SPAN_LITERAL_EMPTY
100 #define _az_STRING_LITERAL_LEN(S) (sizeof(S "") - 1)
112 #define AZ_SPAN_LITERAL_FROM_STR(STRING_LITERAL) \
115 .ptr = (uint8_t*)(STRING_LITERAL), \
116 .size = _az_STRING_LITERAL_LEN(STRING_LITERAL), \
132 #define AZ_SPAN_FROM_STR(STRING_LITERAL) (az_span) AZ_SPAN_LITERAL_FROM_STR(STRING_LITERAL)
136 #define _az_IS_ARRAY(array) (((void*)&(array)) == ((void*)(&(array)[0])))
141 #define _az_IS_BYTE_ARRAY(array) ((sizeof((array)[0]) == 1) && _az_IS_ARRAY(array))
156 #define AZ_SPAN_FROM_BUFFER(BYTE_BUFFER) \
158 (uint8_t*)(BYTE_BUFFER), (sizeof(BYTE_BUFFER) / (_az_IS_BYTE_ARRAY(BYTE_BUFFER) ? 1 : 0)))
217 return span2_size == 0;
223 return span1_size == span2_size
533 az_span* out_next_destination);
535 #include <azure/core/_az_cfg_suffix.h>
Definition of az_result and helper functions.
void * user_context
Definition: az_span.h:497
int32_t minimum_required_size
Definition: az_span.h:505
AZ_NODISCARD az_span az_span_create_from_str(char *str)
Returns an az_span from a 0-terminated array of bytes (chars).
AZ_NODISCARD az_result az_span_atoi32(az_span source, int32_t *out_number)
Parses an az_span containing ASCII digits into an int32_t number.
AZ_NODISCARD az_span az_span_create(uint8_t *ptr, int32_t size)
Returns an az_span over a byte buffer.
int32_t az_result
The type represents the various success and error conditions.
Definition: az_result.h:46
AZ_INLINE void az_span_fill(az_span destination, uint8_t value)
Fills all the bytes of the destination az_span with the specified value.
Definition: az_span.h:311
int32_t bytes_used
Definition: az_span.h:501
AZ_NODISCARD az_span az_span_slice_to_end(az_span span, int32_t start_index)
Returns a new az_span which is a sub-span of the specified span.
az_span az_span_copy(az_span destination, az_span source)
Copies the content of the source az_span to the destination az_span.
AZ_NODISCARD AZ_INLINE uint8_t * az_span_ptr(az_span span)
Returns the az_span byte buffer's starting memory address.
Definition: az_span.h:48
AZ_NODISCARD az_result az_span_u32toa(az_span destination, uint32_t source, az_span *out_span)
Converts an uint32_t into its digit characters (base 10) and copies them to the destination az_span s...
az_result(* az_span_allocator_fn)(az_span_allocator_context *allocator_context, az_span *out_next_destination)
Defines the signature of the callback function that the caller must implement to provide the potentia...
Definition: az_span.h:531
AZ_NODISCARD az_result az_span_i32toa(az_span destination, int32_t source, az_span *out_span)
Converts an int32_t into its digit characters (base 10) and copies them to the destination az_span st...
AZ_NODISCARD az_span az_span_slice(az_span span, int32_t start_index, int32_t end_index)
Returns a new az_span which is a sub-span of the specified span.
AZ_NODISCARD int32_t az_span_find(az_span source, az_span target)
Searches for target in source, returning an az_span within source if it finds it.
AZ_NODISCARD az_result az_span_atou32(az_span source, uint32_t *out_number)
Parses an az_span containing ASCII digits into a uint32_t number.
Defines a container of required and user-defined fields that provide the necessary information and pa...
Definition: az_span.h:494
void az_span_to_str(char *destination, int32_t destination_max_size, az_span source)
Copies a source az_span containing a string (that is not 0-terminated) to a destination char buffer a...
AZ_NODISCARD az_result az_span_dtoa(az_span destination, double source, int32_t fractional_digits, az_span *out_span)
Converts a double into its digit characters (base 10 decimal notation) and copies them to the destina...
AZ_NODISCARD bool az_span_is_content_equal_ignoring_case(az_span span1, az_span span2)
Determines whether two spans are equal by comparing their characters, except for casing.
AZ_NODISCARD az_result az_span_atod(az_span source, double *out_number)
Parses an az_span containing ASCII digits into a double number.
AZ_NODISCARD az_result az_span_u64toa(az_span destination, uint64_t source, az_span *out_span)
Converts a uint64_t into its digit characters (base 10) and copies them to the destination az_span st...
AZ_NODISCARD az_result az_span_atou64(az_span source, uint64_t *out_number)
Parses an az_span containing ASCII digits into a uint64_t number.
AZ_NODISCARD AZ_INLINE int32_t az_span_size(az_span span)
Returns the number of bytes within the az_span.
Definition: az_span.h:55
AZ_NODISCARD az_result az_span_atoi64(az_span source, int64_t *out_number)
Parses an az_span containing ASCII digits into an int64_t number.
AZ_NODISCARD az_result az_span_i64toa(az_span destination, int64_t source, az_span *out_span)
Converts an int64_t into its digit characters (base 10) and copies them to the destination az_span st...
az_span az_span_copy_u8(az_span destination, uint8_t byte)
Copies the uint8_t byte to the destination at its 0-th index.
Represents a "view" over a byte buffer that represents a contiguous region of memory....
Definition: az_span.h:33
AZ_NODISCARD AZ_INLINE bool az_span_is_content_equal(az_span span1, az_span span2)
Determines whether two spans are equal by comparing their bytes.
Definition: az_span.h:207