pub struct MacroString { /* private fields */ }Implementations§
Source§impl MacroString
impl MacroString
Sourcepub fn eval(&self) -> Result<String>
pub fn eval(&self) -> Result<String>
Evaluate expression to string.
§Errors
Returns an error if the expression was syntactically valid (parsed
successfully) but cannot be evaluated, for example because it refers to
an env! for which the environment variable is not set, or an
include! for which the file is not found.
Sourcepub fn error<T: Display>(&self, message: T) -> Error
pub fn error<T: Display>(&self, message: T) -> Error
Construct a compile error with a Span encompassing the macro string’s original expression.
ⓘ
my_macro! {
resources = concat!(env!("CARGO_MANIFEST_DIR"), "/resources.json")
}error: No such file or directory (os error 2) - /path/to/manifest-dir/resources.json
--> example.rs:85:17
|
85 | resources = concat!(env!("CARGO_MANIFEST_DIR"), "/resources.json")
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Trait Implementations§
Source§impl Clone for MacroString
impl Clone for MacroString
Source§fn clone(&self) -> MacroString
fn clone(&self) -> MacroString
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Parse for MacroString
impl Parse for MacroString
fn parse(input: ParseStream<'_>) -> Result<Self>
Auto Trait Implementations§
impl Freeze for MacroString
impl RefUnwindSafe for MacroString
impl !Send for MacroString
impl !Sync for MacroString
impl Unpin for MacroString
impl UnsafeUnpin for MacroString
impl UnwindSafe for MacroString
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more