pub struct UseBuilder { /* private fields */ }
Expand description
The struct to represent the builder for proc_use.
Implementations§
Source§impl UseBuilder
impl UseBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
Returns a UserBuilder with no mod or use statemetns and unused defaulted to true.
Sourcepub fn use_file(&mut self, file: PathBuf, use_stmt: String) -> &mut Self
pub fn use_file(&mut self, file: PathBuf, use_stmt: String) -> &mut Self
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.
Sourcepub fn mod_file_alias(&mut self, file: PathBuf, alias: &str) -> &mut Self
pub fn mod_file_alias(&mut self, file: PathBuf, alias: &str) -> &mut Self
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 importfoo.rs
asmod bar
.
Sourcepub fn use_file_alias(
&mut self,
file: PathBuf,
use_stmt: String,
alias: &str,
) -> &mut Self
pub fn use_file_alias( &mut self, file: PathBuf, use_stmt: String, alias: &str, ) -> &mut Self
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 importfoo.rs
asmod bar
.
Sourcepub fn use_crate(&mut self, use_stmt: String) -> &mut Self
pub fn use_crate(&mut self, use_stmt: String) -> &mut Self
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.
Sourcepub fn mod_glob_alias(&mut self, globstring: &str, alias: &str) -> &mut Self
pub fn mod_glob_alias(&mut self, globstring: &str, alias: &str) -> &mut Self
Sourcepub fn use_glob_alias(
&mut self,
globstring: &str,
use_stmt: String,
alias: &str,
) -> &mut Self
pub fn use_glob_alias( &mut self, globstring: &str, use_stmt: String, alias: &str, ) -> &mut Self
Sourcepub fn allow_unused(&mut self) -> &mut Self
pub fn allow_unused(&mut self) -> &mut Self
Disables the unused import error for each import.
Sourcepub fn warn_unused(&mut self) -> &mut Self
pub fn warn_unused(&mut self) -> &mut Self
Enables the unused import error for each import.
Sourcepub fn write_to_file_use(&mut self, path: PathBuf) -> &mut Self
pub fn write_to_file_use(&mut self, path: PathBuf) -> &mut Self
Sourcepub fn write_to_file_mod(&mut self, path: PathBuf) -> &mut Self
pub fn write_to_file_mod(&mut self, path: PathBuf) -> &mut Self
Sourcepub fn write_to_file_all(&mut self, path: PathBuf) -> &mut Self
pub fn write_to_file_all(&mut self, path: PathBuf) -> &mut Self
Writes the mod and use statements to a file.
§Arguments
path
- A PathBuf to the file that is to be written.
Auto Trait Implementations§
impl Freeze for UseBuilder
impl RefUnwindSafe for UseBuilder
impl Send for UseBuilder
impl Sync for UseBuilder
impl Unpin for UseBuilder
impl UnwindSafe for UseBuilder
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more