pub struct Namer { /* private fields */ }
Expand description
This processor assigns names to all the things in a module that may need identifiers in a textual backend.
Implementations§
source§impl Namer
impl Namer
sourcepub fn call(&mut self, label_raw: &str) -> String
pub fn call(&mut self, label_raw: &str) -> String
Return a new identifier based on label_raw
.
The result:
- is a valid identifier even if
label_raw
is not - conflicts with no keywords listed in
Namer::keywords
, and - is different from any identifier previously constructed by this
Namer
.
Guarantee uniqueness by applying a numeric suffix when necessary. If label_raw
itself ends with digits, separate them from the suffix with an underscore.
pub fn call_or(&mut self, label: &Option<String>, fallback: &str) -> String
pub fn reset( &mut self, module: &Module, reserved_keywords: &[&'static str], extra_reserved_keywords: &[&'static str], reserved_keywords_case_insensitive: &[&'static str], reserved_prefixes: &[&'static str], output: &mut FastHashMap<NameKey, String> )
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Namer
impl Send for Namer
impl Sync for Namer
impl Unpin for Namer
impl UnwindSafe for Namer
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more