wrap_v8_interceptor

Macro wrap_v8_interceptor 

Source
macro_rules! wrap_v8_interceptor {
    ($ vis : vis struct $ name : ident ; impl V8Interceptor { $ ($ (# [$ attrs_name : meta]) * fn $ method_name : ident (& $ self : ident $ (, $ arg_name : ident : $ arg_type : ty) * $ (,) ?) $ (-> $ return_type : ty) ? { $ ($ body : tt) * }) * }) => { ... };
    ($ vis : vis struct $ name : ident $ (< $ ($ generic_type : ident : $ first_generic_type_bound : tt $ (+ $ generic_type_bound : tt) *) , + $ (,) ? >) ? { $ ($ field_vis : vis $ field_name : ident : $ field_type : ty) , * $ (,) ? } impl V8Interceptor { $ ($ (# [$ attrs_name : meta]) * fn $ method_name : ident (& $ self : ident $ (, $ arg_name : ident : $ arg_type : ty) * $ (,) ?) $ (-> $ return_type : ty) ? { $ ($ body : tt) * }) * }) => { ... };
}
Expand description

Implement the WrapV8Interceptor trait for the specified struct. You can declare more members for your struct, and in the impl V8Interceptor block you can override default methods implemented by the ImplV8Interceptor trait.

ยงExample


wrap_v8_interceptor! {
    struct MyV8Interceptor {
        payload: String,
    }

    impl V8Interceptor {
        // ...
    }
}

fn make_my_struct() -> V8Interceptor {
    MyV8Interceptor::new("payload".to_string())
}