Improve documentation on duplex.rs

Adding example and short documentation for methods.
The indentation is weird here.