Struct rust_format::Config
source · [−]pub struct Config<K, P, V> where
K: Eq + Hash + AsRef<OsStr>,
P: Into<PathBuf>,
V: AsRef<OsStr>, { /* private fields */ }
Expand description
The configuration for the formatters. Most of the options are for rustfmt
only (they are ignored
by PrettyPlease, but PostProcess options are used by both formatters).
Implementations
sourceimpl<'a, 'b> Config<&'a str, &'b str, &'a str>
impl<'a, 'b> Config<&'a str, &'b str, &'a str>
sourcepub fn new_str() -> Self
pub fn new_str() -> Self
Creates a new blank configuration with &str
for all type params
(if you wish to use different types, use new instead)
sourcepub fn from_hash_map_str(options: HashMap<&'a str, &'a str>) -> Self
pub fn from_hash_map_str(options: HashMap<&'a str, &'a str>) -> Self
Creates a new configuration from the given HashMap of options using &str
for all type params
(if you wish to use different types, use from_hash_map instead)
sourceimpl<K, P, V> Config<K, P, V> where
K: Eq + Hash + AsRef<OsStr>,
P: Into<PathBuf>,
V: AsRef<OsStr>,
impl<K, P, V> Config<K, P, V> where
K: Eq + Hash + AsRef<OsStr>,
P: Into<PathBuf>,
V: AsRef<OsStr>,
sourcepub fn from_hash_map(options: HashMap<K, V>) -> Self
pub fn from_hash_map(options: HashMap<K, V>) -> Self
Creates a new configuration from the given HashMap of options with no type assumptions
sourcepub fn rust_fmt_path(self, path: P) -> Self
pub fn rust_fmt_path(self, path: P) -> Self
Set the path to the rustfmt
binary to use (RustFmt
only, ignored by PrettyPlease
).
This takes precedence over the RUSTFMT
environment variable, if specified
sourcepub fn edition(self, edition: Edition) -> Self
pub fn edition(self, edition: Edition) -> Self
Set the Rust edition of the source input (RustFmt
only, ignored by PrettyPlease
)
sourcepub fn post_proc(self, post_proc: PostProcess) -> Self
pub fn post_proc(self, post_proc: PostProcess) -> Self
Set the post processing option after formatting (used by both RustFmt
and PrettyPlease
)
Trait Implementations
sourceimpl<K: Clone, P: Clone, V: Clone> Clone for Config<K, P, V> where
K: Eq + Hash + AsRef<OsStr>,
P: Into<PathBuf>,
V: AsRef<OsStr>,
impl<K: Clone, P: Clone, V: Clone> Clone for Config<K, P, V> where
K: Eq + Hash + AsRef<OsStr>,
P: Into<PathBuf>,
V: AsRef<OsStr>,
Auto Trait Implementations
impl<K, P, V> RefUnwindSafe for Config<K, P, V> where
K: RefUnwindSafe,
P: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, P, V> Send for Config<K, P, V> where
K: Send,
P: Send,
V: Send,
impl<K, P, V> Sync for Config<K, P, V> where
K: Sync,
P: Sync,
V: Sync,
impl<K, P, V> Unpin for Config<K, P, V> where
K: Unpin,
P: Unpin,
V: Unpin,
impl<K, P, V> UnwindSafe for Config<K, P, V> where
K: UnwindSafe,
P: UnwindSafe,
V: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more