parr

Crates.ioparr
lib.rsparr
version
sourcesrc
created_at2024-10-06 20:08:59.666244
updated_at2024-10-12 16:19:49.827392
descriptionA C-like unknown-length array type.
homepage
repositoryhttps://github.com/andofwinds/parr
max_upload_size
id1399363
Cargo.toml error:TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
andofwinds (andofwinds)

documentation

README

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) { }
Commit count: 10

cargo fmt