Adding feature required Tag to Rust Documentation

I had a lot of trouble understanding this. Thus I am documenting it here for myself. All credit goes to the original StackOverFlow author.

  1. Add one of the following to the root of your crate. Usually lib.rs
    1.

    #![feature(doc_cfg)]
    

    This is less than ideal as it will cause compile errors when used with stable
    2. It is better to use:

    #![cfg_attr(docsrs, feature(doc_cfg))]
    

    This allows this to be conditionally compiled and does not give any errors.

    [Read More]