pinpoint 0.1.2

Crate for pinned references
Documentation
  • Coverage
  • 100%
    1 out of 1 items documented1 out of 1 items with examples
  • Size
  • Source code size: 19.34 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.05 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • DutchGhost

pinpoint

This crate provides the IntoPin trait. IntoPin is powerfull for creating coerced, pinned references.

Example

#![feature(pin)]

extern crate pinpoint;

use std::pin::Pin;
use pinpoint::IntoPin;

fn example<'a, P>(item: P)
where
    P: IntoPin<&'a mut [u8]>
{
    let mut pin: Pin<&mut [u8]> = item.into_pin();
    pin.reverse();
}

let mut v = vec![1, 2, 3, 4];
example(&mut v);
assert_eq!(v, [4, 3, 2, 1]);

let mut b: Box<[u8]> = Box::new([4, 3, 2, 1]);
example(&mut b);
assert_eq!(*b, [1, 2, 3, 4]);