macro_rules! class {
{
$(#[$meta:meta])*
$name:ident $($modifier:tt)*
} => { ... };
{@Typeof
$(#[$meta:meta])*
$name:ident $($modifier:tt)*
} => { ... };
{@Define
$(#[$meta:meta])*
$name:ident
} => { ... };
{@Define
$(#[$meta:meta])*
$name:ident !PartialEq
} => { ... };
{@Implement
$name:ident
} => { ... };
}Expand description
Defines a new AS3 class.
Accepts a unique class name as an argument.
By default, the generated class implements PartialEq<Self> and Eq
using pointer equality. This can be disabled by adding the !PartialEq modifier.
ยงExamples
use fre_rs::prelude::*;
fre_rs::class! (EventDispatcher);
impl<'a> EventDispatcher<'a> {
pub fn new (ctx: &CurrentContext<'a>) -> Self {
unsafe {ctx.construct(fre_rs::ucstringify!(flash.events.EventDispatcher), None)
.expect("Object construction failed.")
.as_unchecked()}
}
}
fre_rs::class! (XML !PartialEq);
impl PartialEq for XML<'_> {
fn eq(&self, other: &Self) -> bool {todo!()}
}
impl Eq for XML<'_> {}