Fix compile for OSX & various other changes

Each commit is reasonably localised, but the main changes are:
- Fix the build for OSX (and probably some other systems)
- Factored a number of places
- Move the pipeline example so it's built with `cargo test` on the main repo
- Fixed re-exports across the project so there were less strange build problems for name resolution

If requested I can split the PR, but I think it's pretty minor overall, I haven't tagged anything as breaking since most things are marked unstable.