#representation #unsafe #ptr #data #raw-pointers #slice #methods

nightly raw

Utilities for unsafely manipulating raw representations in Rust

5 releases

Uses old Rust 2015

0.0.6 Jun 5, 2015
0.0.5 Feb 27, 2015
0.0.4 Jan 8, 2015
0.0.3 Dec 16, 2014
0.0.2 Nov 19, 2014

#2758 in Rust patterns

Download history 86/week @ 2024-02-11 248/week @ 2024-02-18 17/week @ 2024-02-25 1/week @ 2024-03-03 5/week @ 2024-03-10

296 downloads per month

MIT/Apache

30KB
451 lines

raw-rs

Utilities for doing unsafe work with the raw representations of data in Rust


lib.rs:

Utilities for working with the raw representations of core Rust data types.

This library provides convenience methods and types for doing unsafe work in a more ergonomic way. It provides extension traits for the raw pointer types *const T and *mut T, as well as the raw slice types *const [T] and *mut [T]. It also provides a wrapper for slices that has all of its operations unchecked. Functionality is separated into modules so that they can opted into individually using a glob import.

For the most part, the methods provided are conveniences for those found in the std::ptr API, which can be a bit awkward. Method names reflect a proposed set of names for std::ptr stabilization, and not the actual names. Should std::ptr be stabilized, these may be renamed.

Note also that an ideal implementation of this library provides many of the offered methods as unsafe operators. Unfortunately, this is not currently possible in Rust as of this writing. We instead settle for named methods that mirror these operators.

No runtime deps