Crate refraction

Source
Expand description

refraction is a lens library for Rust. Its design is based broadly on that of the Haskell lens package, but reworked and reorganized to become more Rusty.

The nightly cargo feature flag can be used to enable some features only available on nightly Rust:

  • Lenticuloids that deal with the ! type
  • const fn support
  • More efficient implementation of some macros

To get started easily, import refraction::prelude::*.

Modules§

access
collections
conv
These lenticuloids handle lossless conversions via the standard library traits Into, AsRef and AsMut.
errors
These lenticuloids deal with Rust’s basic error-handling types: Option and Result.
meta
prelude
A prelude module suitible for glob-importing.
terminal
These lenticuloids deal with the trivial and the impossible; that is, they operate with values of types () and ! (the latter only on nightly Rust, with the nightly feature flag enabled).
util
Some utility functions used inside this crate, but possibly useful for others as well.

Macros§

chain_and_then
Compose all the provided lenticuloids in intuitive order.
chain_compose
Compose all the provided lenticuloids in categorical order.
field_lens
Create a simple lens inline to address a specific (possibly nested) field of a type.

Structs§

Compose
Composition of lenticuloids.
Identity
The identity lenticuloid.
Invert
The inversion of a lenticuloid.

Traits§

AndThenExt
Extension trait for lenticuloid composition in intuitive order.
ComposeExt
Extension trait for lenticuloid composition in categorical order.
InvertExt
Extension trait for lenticuloid inversion.
Iso
The supertype of all isomorphism families.
Lens
The supertype of all lens families.
Lenticuloid
The supertype of all lenticuloids.
PartialLens
The supertype of all partial lens families.
Prism
The supertype of all prism families.

Functions§

identity
The identity lenticuloid (function form).

Type Aliases§

Injector