I am creating a fairly complex macro and can't use the overloading syntax to create my macros. I am trying to conditionally check if a prop has been defined within an optional capture group or not:
macro_rules! foo {
(name: $name: ident$(, media: $media: tt)?) => {
pub struct $name;
impl $name {
// how do i use media here and also provide default
// const MEDIA: &str = IF_DEFINED $media { $media } ELSE { "DEFAULT" };
}
};
}
foo! {
name: Hey,
media: "hey"
}
foo! {
name: Hey2
}