unsaferef 0.1.0

An unsafe reference without explicit lifetime
Documentation
  • Coverage
  • 0%
    0 out of 5 items documented0 out of 0 items with examples
  • Size
  • Source code size: 10.24 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 479.87 kB 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
  • Homepage
  • ohkami-rs/unsaferef
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • github:ohkami-rs:core kanarus

Example

use unsaferef::UnsafeRef;

fn main() {
    let data = String::from("Hello, world!");

    // SAFETY: `data` is alive as long as `r` is in use
    let r: UnsafeRef<String> = unsafe {
        UnsafeRef::new(&data)
    };

    assert_eq!(*r, "Hello, world!");

    drop(data)
}

no-std and cow

UnsafeRef supports no-std::no-alloc.

On alloc feature ( default ), unsaferef additionally provides UnsafeCow, an unsafe Clone-on-Write container without explicit lifetime.

License

unsaferef is licensed under MIT LICENSE ( LICENSE or https://opensource.org/licenses/MIT ).