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 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.

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: const NSTDSlice *const slice - The slice.

Type Definitions

Represents a unicode char type.