Trait Renamer

Source
pub trait Renamer: Send + Sync {
    type Target: RenamedVariable;

    const RESET_N: bool;
    const MANGLE: bool;

    // Required method
    fn new_name_for(&self, orig: &Id, n: &mut usize) -> Atom;

    // Provided methods
    fn get_cached(&self) -> Option<Cow<'_, FxHashMap<Id, Self::Target>>> { ... }
    fn store_cache(&mut self, _update: &FxHashMap<Id, Self::Target>) { ... }
    fn unresolved_symbols(&self) -> Vec<Atom> { ... }
    fn preserve_name(&self, _orig: &Id) -> bool { ... }
}

Required Associated Constants§

Source

const RESET_N: bool

Should reset n to 0 for each identifier?

Source

const MANGLE: bool

It should be true if you expect lots of collisions

Required Associated Types§

Source

type Target: RenamedVariable

See the RenamedVariable documentation, this type determines whether impls can be used with renamer or renamer_keep_contexts .

Required Methods§

Source

fn new_name_for(&self, orig: &Id, n: &mut usize) -> Atom

Should increment n.

Provided Methods§

Source

fn get_cached(&self) -> Option<Cow<'_, FxHashMap<Id, Self::Target>>>

Source

fn store_cache(&mut self, _update: &FxHashMap<Id, Self::Target>)

Source

fn unresolved_symbols(&self) -> Vec<Atom>

Source

fn preserve_name(&self, _orig: &Id) -> bool

Return true if the identifier should be preserved.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§