1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
pub mod optics;
pub mod traits;

pub use traits::{
    Lens, LensMut, LensRef, Prism, PrismMut, PrismRef, Review, Traversal, TraversalMut,
    TraversalRef,
};

pub use optics::{
    _both, _mapped, _arc, _box, Err, _mut, _rc, _ref, _0, _1, _2, _3, _4, _5, _6,
    __,
};

pub use lens_rs_derive::{Lens, Prism, Review};

#[macro_export]
macro_rules! optics {
    () => { lens_rs::optics::__ };
    ($optic:ident) => { lens_rs::optics::$optic(lens_rs::optics::__) };
    ($optic:ident . $($optics:tt)*) => {
        lens_rs::optics::$optic(optics!($($optics)*))
    }
}

#[macro_export]
macro_rules! field {
    [] => { lens_rs::optics::__ };
    [$optic:ident] => { lens_rs::optics::$optic<lens_rs::optics::__> };
    [$optic:ident . $($optics:tt)*] => {
        lens_rs::optics::$optic<field![$($optics)*]>
    }
}