field-project 0.1.0

Field projection for all!
Documentation
  • Coverage
  • 5.56%
    1 out of 18 items documented1 out of 12 items with examples
  • Size
  • Source code size: 8.83 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.56 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • lachlansneff/field-project
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • lachlansneff

field-project

Generic projection for all types! This crate adds projection support, through the Project trait and proj! macro to all types in Rust. No derive required!

use std::pin::Pin;
use field_project::proj;

struct Foo {
    a: i32,
    b: &'static str,
}

fn main() {
    let foo = Box::pin(Foo { a: 42, b: "hello, world" });

    let a: Pin<_> = proj!(foo.a);
    let b = proj!(foo.b);

    println!("a: {:?}, b: {:?}", a, b);
}