Add a note discouraging new use of dialect_of macro (#1448)

This commit is contained in:
Andrew Lamb 2024-09-30 07:08:13 -04:00 committed by GitHub
parent 51cbd5a3e6
commit ce2686a169
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -60,6 +60,13 @@ use alloc::boxed::Box;
/// Convenience check if a [`Parser`] uses a certain dialect.
///
/// Note: when possible please the new style, adding a method to the [`Dialect`]
/// trait rather than using this macro.
///
/// The benefits of adding a method on `Dialect` over this macro are:
/// 1. user defined [`Dialect`]s can customize the parsing behavior
/// 2. The differences between dialects can be clearly documented in the trait
///
/// `dialect_of!(parser Is SQLiteDialect | GenericDialect)` evaluates
/// to `true` if `parser.dialect` is one of the [`Dialect`]s specified.
macro_rules! dialect_of {