Skip to content

Commit

Permalink
Add a note discouraging new use of dialect_of macro (#1448)
Browse files Browse the repository at this point in the history
  • Loading branch information
alamb authored Sep 30, 2024
1 parent 51cbd5a commit ce2686a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/dialect/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit ce2686a

Please sign in to comment.