Macro type_str

Source
macro_rules! type_str {
    ($vis: vis $name: ident = $value: expr $(=> $doc: expr)?) => { ... };
}
Expand description

Lifts static strings to type-level strings.

ยงExamples

use refinement_types::type_str;

type_str!(HelloWorld = "Hello, world!");

Is equivalent to:

use core::{fmt, marker::PhantomData};

use refinement_types::{StaticStr, TypeStr};

struct HelloWorld {
    private: PhantomData<()>,
}

impl TypeStr for HelloWorld {
    const VALUE: StaticStr = "Hello, world!";
}