parr 0.1.3

A C-like unknown-length array type.
Documentation
  • Coverage
  • 100%
    5 out of 5 items documented1 out of 5 items with examples
  • Size
  • Source code size: 21.86 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.08 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 8s Average build duration of successful builds.
  • all releases: 8s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • andofwinds/parr
    2 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • andofwinds

The Pointer Array (PArr).

Provides a type to make raw pointer indexable as an array, just like in C!

Examples

New from raw address

let arr: Parr<u8> = Parr::new(&[11_u8, 22, 33, 44] as *const _ as u64);
assert_eq!(arr[1], 22);

Same code in C:

uint8_t arr[] = {11, 22, 33, 44};
// arr[1] == 22

Usage in structures

#[repr(C)]
struct Foo {
    arr: Parr<u8>,
}

Same code in C:

struct foo {
    uint8_t* arr,
};

Usage in function arguments

extern "C" fn foo(arr: Parr<u8>) { }

Same code in C:

void foo(uint8_t* arr) { }