pub trait Lint<I> {
// Required method
fn lint(&self, input: &I, c: &mut Collector);
}
Expand description
Lint is used for linting the macro input
§Example
use macro_compose::{Collector, Lint};
use syn::{Data, DeriveInput, Error};
struct EnsureStructLint;
impl Lint<DeriveInput> for EnsureStructLint {
fn lint(&self, input: &DeriveInput, c: &mut Collector) {
if !matches!(&input.data, Data::Struct(_)) {
c.error(Error::new_spanned(input, "expected a struct"));
}
}
}