Crate nstd_core[−][src]
Structs
Represents a signed range.
Represents a view into a sequence of data.
Represents an unsigned range.
Enums
Represents a CPU architecture.
Represents an operating system.
Functions
Returns the size (in bytes) of a pointer.
Returns: NSTDUSize size - Size of a pointer.
Returns the unicode replacement character (�).
Returns: NSTDUnichar chr - The unicode replacement character.
Converts a character to lowercase.
Parameters:
const NSTDUnichar chr - A 32-bit char.
Returns: NSTDUnichar chr - The lowercase version.
Converts a character to uppercase.
Parameters:
const NSTDUnichar chr - A 32-bit char.
Returns: NSTDUnichar chr - The uppercase version.
Returns a null pointer.
Returns: void *null - A null pointer.
Copies bytes from other to copycat.
Parameters:
NSTDByte *const copycat - Pointer to memory to be copied to.
const NSTDByte *const other - Pointer to memory to be copied from.
const NSTDUSize size - Number of bytes to copy.
Fills a block of memory with byte.
Parameters:
NSTDByte *const ptr - Pointer to block of memory.
const NSTDUSize size - Size of block.
const NSTDByte byte - Byte to fill with.
Moves bytes from from to to. Zeroes out from’s memory.
Parameters:
NSTDByte *const from - Memory to be moved from.
NSTDByte *const to - Memory to be moved to.
const NSTDUSize size - Number of bytes to move.
Moves memory from *ptr1 to *ptr2 and vice versa.
Parameters:
void *const ptr1 - First pointer to memory to swap.
void *const ptr2 - Second pointer to memory to swap.
const NSTDUSize size - Number of bytes to swap.
Zeros a memory range pointed to by ptr.
Parameters:
NSTDByte *const ptr - Pointer to memory to be zeroed.
NSTDUSize start - Starting index of memory to be zeroed.
const NSTDUSize end - Ending index of memory to be zeroed. (Excluded).
Returns an NSTDCPUArch value representing the target CPU architecture.
Returns: NSTDCPUArch arch - The target CPU architecture.
Returns an NSTDOperatingSystem value representing the target OS.
Returns: NSTDOperatingSystem os - The target OS.
Checks if a slice contains element.
Parameters:
const NSTDSlice *const slice - The slice.
const void *const element - The element to search for.
Returns: NSTDInt32 is_in - Nonzero if the slice contains element.
Copies elements from s1 to s2. The slices must be the same size in bytes.
Parameters:
NSTDSlice *const s1 - The slice to copy to.
const NSTDSlice *const s2 - The slice to copy from.
Checks if a slice ends with another slice.
Parameters:
const NSTDSlice *const slice - The slice.
const NSTDSlice *const pattern - The slice pattern.
Returns: NSTDInt32 ends_with - Nonzero if slice ends with pattern.
Fills a slice with element.
Parameters:
NSTDSlice *const slice - The slice.
const void *const element - The element.
Gets the first element in the slice.
NOTE: This function follows the same behaviour rules as nstd_core_slice_get.
Parameters:
const NSTDSlice *const slice - The slice.
Returns: void *element - Pointer to the first element.
Gets a pointer to an element from a slice.
NOTE: The returned element pointer can quickly become a dangling pointer if the slice’s memory
gets reallocated or deallocated, so it is advised to create a copy of the element after
getting it.
Parameters:
const NSTDSlice *const slice - The slice.
const NSTDUSize pos - The position of the element to get.
Returns: void *element - Pointer to the element.
Gets the last element in the slice.
NOTE: This function follows the same behaviour rules as nstd_core_slice_get.
Parameters:
const NSTDSlice *const slice - The slice.
Returns: void *element - Pointer to the last element.
Creates a new slice from raw data.
Parameters:
const NSTDUSize size - Number of elements to slice.
const NSTDUSize element_size - Size of each element.
NSTDByte *const data - Pointer to the raw data.
Returns: NSTDSlice slice - The new slice.
Reverses a slice’s elements.
Parameters:
NSTDSlice *const slice - The slice.
Shifts a slice x times to the left.
Parameters:
NSTDSlice *const slice - The slice.
const NSTDUSize x - Number of times to shift the slice.
Shifts a slice x times to the right.
Parameters:
NSTDSlice *const slice - The slice.
const NSTDUSize x - Number of times to shift the slice.
Checks if a slice starts with another slice.
Parameters:
const NSTDSlice *const slice - The slice.
const NSTDSlice *const pattern - The slice pattern.
Returns: NSTDInt32 starts_with - Nonzero if slice starts with pattern.
Swaps two elements in a slice.
Parameters:
NSTDSlice *const slice - The slice.
const NSTDUSize i - The index of the first element.
const NSTDUSize j - The index of the second element.
Swaps the elements of s1 and s2. The slices must be the same size in bytes.
Parameters:
NSTDSlice *const s1 - The first slice.
NSTDSlice *const s2 - The second slice.
Type Definitions
Represents a unicode char type.