Skip to main content

limbo_sqlite3_parser/parser/ast/
name_traits.rs

1//! # `Name` - Trait Implementations
2//!
3//! This module contains trait implementations for `Name`.
4//!
5//! ## Implemented Traits
6//!
7//! - `Hash`
8//! - `PartialEq`
9//! - `PartialEq`
10//! - `PartialEq`
11//!
12//! 🤖 Generated with [SplitRS](https://github.com/cool-japan/splitrs)
13
14use std::str::{self};
15
16use super::functions::eq_ignore_case_and_quote;
17use super::types::Name;
18use super::types_10::QuotedIterator;
19
20/// Ignore case and quote
21impl std::hash::Hash for Name {
22    fn hash<H: std::hash::Hasher>(&self, hasher: &mut H) {
23        self.as_bytes()
24            .for_each(|b| hasher.write_u8(b.to_ascii_lowercase()));
25    }
26}
27/// Ignore case and quote
28impl PartialEq for Name {
29    fn eq(&self, other: &Self) -> bool {
30        eq_ignore_case_and_quote(self.as_bytes(), other.as_bytes())
31    }
32}
33/// Ignore case and quote
34impl PartialEq<str> for Name {
35    fn eq(&self, other: &str) -> bool {
36        eq_ignore_case_and_quote(self.as_bytes(), QuotedIterator(other.bytes(), 0u8))
37    }
38}
39/// Ignore case and quote
40impl PartialEq<&str> for Name {
41    fn eq(&self, other: &&str) -> bool {
42        eq_ignore_case_and_quote(self.as_bytes(), QuotedIterator(other.bytes(), 0u8))
43    }
44}