Skip to content

Commit ce2686a

Browse files
authored
Add a note discouraging new use of dialect_of macro (apache#1448)
1 parent 51cbd5a commit ce2686a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/dialect/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ use alloc::boxed::Box;
6060

6161
/// Convenience check if a [`Parser`] uses a certain dialect.
6262
///
63+
/// Note: when possible please the new style, adding a method to the [`Dialect`]
64+
/// trait rather than using this macro.
65+
///
66+
/// The benefits of adding a method on `Dialect` over this macro are:
67+
/// 1. user defined [`Dialect`]s can customize the parsing behavior
68+
/// 2. The differences between dialects can be clearly documented in the trait
69+
///
6370
/// `dialect_of!(parser Is SQLiteDialect | GenericDialect)` evaluates
6471
/// to `true` if `parser.dialect` is one of the [`Dialect`]s specified.
6572
macro_rules! dialect_of {

0 commit comments

Comments
 (0)