pub struct ImportSet { /* private fields */ }Expand description
Per-file import collector. Maps simple name → owning FQN; first registration wins, later distinct FQNs with the same simple name render fully qualified.
Implementations§
Source§impl ImportSet
impl ImportSet
pub fn new(package: impl Into<String>) -> Self
Sourcepub fn short(&mut self, name: &str) -> String
pub fn short(&mut self, name: &str) -> String
Resolve a (possibly dotted) name to the text the use site should
emit, registering an import when needed. Only a dotted identifier
path (io.zenoh.jni.ZKeyExpr) is treated as an FQN; any other
shape (dot-free names, verbatim function-type strings) renders
unchanged.
Sourcepub fn register(&mut self, fqn: &str)
pub fn register(&mut self, fqn: &str)
Register an FQN referenced only inside raw code text (so the import
line is emitted even though no KtType renders it).
Sourcepub fn import_lines(&self) -> Vec<String>
pub fn import_lines(&self) -> Vec<String>
The sorted import lines for the file: every registered FQN except same-package ones.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ImportSet
impl RefUnwindSafe for ImportSet
impl Send for ImportSet
impl Sync for ImportSet
impl Unpin for ImportSet
impl UnsafeUnpin for ImportSet
impl UnwindSafe for ImportSet
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