mirror of
https://github.com/bevyengine/bevy
synced 2025-01-05 09:48:55 +00:00
e5dbde86fb
# Objective - Fixes #9363 ## Solution Moved `fq_std` from `bevy_reflect_derive` to `bevy_macro_utils`. This does make the `FQ*` types public where they were previously private, which is a change to the public-facing API, but I don't believe a breaking one. Additionally, I've done a basic QA pass over the `bevy_macro_utils` crate, adding `deny(unsafe)`, `warn(missing_docs)`, and documentation where required.
36 lines
779 B
Rust
36 lines
779 B
Rust
use std::fmt::{self, Display};
|
|
use syn::{Ident, Path};
|
|
|
|
/// A single named value, representable as a [string](str).
|
|
#[derive(Copy, Clone)]
|
|
pub struct Symbol(pub &'static str);
|
|
|
|
impl PartialEq<Symbol> for Ident {
|
|
fn eq(&self, word: &Symbol) -> bool {
|
|
self == word.0
|
|
}
|
|
}
|
|
|
|
impl<'a> PartialEq<Symbol> for &'a Ident {
|
|
fn eq(&self, word: &Symbol) -> bool {
|
|
*self == word.0
|
|
}
|
|
}
|
|
|
|
impl PartialEq<Symbol> for Path {
|
|
fn eq(&self, word: &Symbol) -> bool {
|
|
self.is_ident(word.0)
|
|
}
|
|
}
|
|
|
|
impl<'a> PartialEq<Symbol> for &'a Path {
|
|
fn eq(&self, word: &Symbol) -> bool {
|
|
self.is_ident(word.0)
|
|
}
|
|
}
|
|
|
|
impl Display for Symbol {
|
|
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
|
formatter.write_str(self.0)
|
|
}
|
|
}
|