codegen/
import.rs

1/// Defines an import (`use` statement).
2#[derive(Debug, Clone)]
3pub struct Import {
4    line: String,
5
6    /// Function visibility
7    pub vis: Option<String>,
8}
9
10impl Import {
11    /// Return a new import.
12    pub fn new(path: &str, ty: &str) -> Self {
13        Import {
14            line: format!("{}::{}", path, ty),
15            vis: None,
16        }
17    }
18
19    /// Set the import visibility.
20    pub fn vis(&mut self, vis: &str) -> &mut Self {
21        self.vis = Some(vis.to_string());
22        self
23    }
24}