Crate displaydoc_lite[][src]

Lite version of displaydoc.

This crate is a lite version of the popular crate displaydoc. It provides the same functionality but using a declarative macro instead and not depending on syn or quote.

This crate is also usable in no_std environments. No additional features are required for that.

Note that displaydoc-lite still has two proc-macro dependencies, but they are very tiny and do not have any dependencies.

Example

use displaydoc_lite::displaydoc;
use std::io;

displaydoc! {
    #[derive(Debug)]
    pub enum DataStoreError {
        /// data store disconnected: {_0}
        Disconnect(io::Error),
        /// the data for key `{_0}` is not available
        Redaction(String),
        /// invalid header (expected {expected}, found {found})
        InvalidHeader {
            expected: String,
            found: String,
        },
        /// unknown data store error
        Unknown,
    }
}

Support for interpolating fields is planed, but currently not implemented.

License

Licensed under either Apache License or the MIT license.

Macros

__defile_expr__

This macro is copied from the defile crate

displaydoc

The main macro of this crate which is used to create the Display implementation for an enum.