pathmod

Crates.iopathmod
lib.rspathmod
version0.1.3
created_at2025-09-02 12:15:20.094985+00
updated_at2025-09-02 13:31:46.496981+00
descriptionRe-export crate for pathmod
homepagehttps://github.com/dahankzter/pathmod-rs
repositoryhttps://github.com/dahankzter/pathmod-rs
max_upload_size
id1821053
size13,994
Henrik Johansson (dahankzter)

documentation

https://docs.rs/pathmod

README

Pathmod crate

Crates.io docs.rs

Purpose

  • This is the user-facing, re-export crate for Pathmod. Depend on this crate in your application/library to use the derive and runtime with a single import path.
  • It re-exports:
    • pathmod_core::Accessor and its prelude
    • pathmod_derive::Accessor (the derive macro)

Quick use

  • Bring the API into scope:
    • use pathmod::prelude::*;
  • Derive and compose accessors:
    • #[derive(Accessor)] on your structs to get pub const acc_() (or acc_() for tuple fields).
    • Compose with Accessor::compose for deep focus.

Example See the top-level README.md for complete, runnable examples, including deep composition. A tiny sketch:

use pathmod::prelude::*;

#[derive(Accessor)]
struct Inner { x: i32 }

#[derive(Accessor)]
struct Outer { inner: Inner }

fn demo(mut o: Outer) {
    let acc = Outer::acc_inner().compose(Inner::acc_x());
    acc.set_mut(&mut o, |v| *v += 1);
}

When should I depend on this crate?

  • In almost all cases. It provides a smooth developer experience by consolidating the runtime type and the derive macro under one path.

Notes

  • This crate intentionally contains minimal code (mostly re-exports). Coverage tools may omit it from summaries because it has few/no instrumentable lines. Tests still run against it to validate the public UX.
  • MSRV: 1.89+ (via core::mem::offset_of! used by the derive). Use a newer toolchain if necessary.

License Dual-licensed under MIT or Apache-2.0.

Commit count: 29

cargo fmt