[][src]Struct proc_use::UseBuilder

pub struct UseBuilder { /* fields omitted */ }

The struct to represent the builder for proc_use.

Implementations

impl UseBuilder[src]

pub fn new() -> Self[src]

Returns a UserBuilder with no mod or use statemetns and unused defaulted to true.

pub fn mod_file(&mut self, file: PathBuf) -> &mut Self[src]

Adds a file to mod to the builder.

Arguments

  • file - A PathBuf to the file that needs to be modded.

pub fn use_file(&mut self, file: PathBuf, use_stmt: String) -> &mut Self[src]

Adds a file to use to the builder, and use pattern.

Arguments

  • file - A PathBuf to the file that needs to be modded.
  • use_stmt - A String that holds the use pattern for the file.

pub fn mod_file_alias(&mut self, file: PathBuf, alias: &str) -> &mut Self[src]

Adds a file to use to the builder. Uses an alias on mod statement.

Arguments

  • file - A PathBuf to the file that needs to be modded.
  • alias - Alternate name for imported mod. Eg import foo.rs as mod bar.

pub fn use_file_alias(
    &mut self,
    file: PathBuf,
    use_stmt: String,
    alias: &str
) -> &mut Self
[src]

Adds a file to use to the builder, and use pattern. Uses an alias on mod statement.

Arguments

  • file - A PathBuf to the file that needs to be modded.
  • use_stmt - A String that holds the use pattern for the file.
  • alias - Alternate name for imported mod. Eg import foo.rs as mod bar.

pub fn use_crate(&mut self, use_stmt: String) -> &mut Self[src]

Adds a crate to use to the builder with a use pattern.

Arguments

  • use_stmt - A String that holds the use pattern for the crate.

pub fn mod_glob(&mut self, globstring: &str) -> &mut Self[src]

Glob a file path for files to mod.

Arguments

  • globstring - The glob pattern string to match.

Example

let builder = UseBuilder::new()
        .mod_glob("src/util/*.rs");

pub fn use_glob(&mut self, globstring: &str, use_stmt: String) -> &mut Self[src]

Glob a file path for files to use.

Arguments

  • globstring - The glob pattern string to match.

Example

let builder = UseBuilder::new()
        .use_glob("src/util/*.rs", "*".into());

pub fn mod_glob_alias(&mut self, globstring: &str, alias: &str) -> &mut Self[src]

Glob a file path for files to mod. Uses an alias on mod statement.

Arguments

  • globstring - The glob pattern string to match.

Example

let builder = UseBuilder::new()
        .mod_glob("src/util/*.rs");
  • alias - Alternate name for imported mod. Eg import foo.rs as mod bar.

pub fn use_glob_alias(
    &mut self,
    globstring: &str,
    use_stmt: String,
    alias: &str
) -> &mut Self
[src]

Glob a file path for files to use. Uses an alias on mod statement.

Arguments

  • globstring - The glob pattern string to match.

Example

let builder = UseBuilder::new()
        .use_glob("src/util/*.rs", "*".into());
  • alias - Alternate name for imported mod. Eg import foo.rs as mod bar.

pub fn allow_unused(&mut self) -> &mut Self[src]

Disables the unused import error for each import.

pub fn warn_unused(&mut self) -> &mut Self[src]

Enables the unused import error for each import.

pub fn write_to_file_use(&mut self, path: PathBuf) -> &mut Self[src]

Writes the use statements to a file.

Arguments

  • path - A PathBuf to the file that is to be written.

pub fn write_to_file_mod(&mut self, path: PathBuf) -> &mut Self[src]

Writes the mod statements to a file.

Arguments

  • path - A PathBuf to the file that is to be written.

pub fn write_to_file_all(&mut self, path: PathBuf) -> &mut Self[src]

Writes the mod and use statements to a file.

Arguments

  • path - A PathBuf to the file that is to be written.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.