graphitepdf-utils 0.3.0

Lightweight utility functions for GraphitePDF and related Rust workflows.
Documentation
  • Coverage
  • 0%
    0 out of 42 items documented0 out of 0 items with examples
  • Size
  • Source code size: 23.04 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.42 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 2s Average build duration of successful builds.
  • all releases: 3s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • admirsaheta/graphite-pdf
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • admirsaheta

Overview

graphitepdf-utils collects small, dependency-free helpers for collection transforms, composition, object-like values, and string parsing.


Scope

graphitepdf-utils includes:

  • collection helpers such as adjust, cast_array, drop_last, last, repeat, reverse, and without
  • composition helpers such as compose and async_compose
  • object and value helpers such as get, pick, omit, map_values, and evolve
  • parsing and string helpers such as parse_float, match_percent, capitalize, and upper_first

Installation

cargo add graphitepdf-utils

API Summary

Category Items
Collection helpers adjust, cast_array, drop_last, last, repeat, reverse, without, OneOrMany
Function composition compose, async_compose
Object and value helpers Object, Value, Keys, Path, get, pick, omit, map_values, evolve, Transform, TransformMap
Parsing and string helpers is_nil, capitalize, upper_first, parse_float, match_percent, PercentMatch

Example

use graphitepdf_utils::{compose, match_percent, parse_float};

fn main() {
    let add_one = |x| x + 1;
    let double = |x| x * 2;
    let pipeline = compose(double, add_one);

    assert_eq!(pipeline(5), 12);
    assert_eq!(parse_float("10px"), Some(10.0));
    assert_eq!(match_percent("50%").map(|value| value.percent), Some(0.5));
}

Design Principles

  • keep the crate dependency-free
  • prefer explicit helpers over framework-style abstractions
  • keep utilities focused and composable
  • support higher-level GraphitePDF crates without assuming a specific runtime

Role In GraphitePDF

This crate provides shared helper logic used by higher-level GraphitePDF crates. Keeping these APIs isolated makes it easier to reuse common transforms and parsing logic without pulling in rendering-specific dependencies.


License

MIT