rust_format

Struct 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§

Source§

impl<'a, 'b> Config<&'a str, &'b str, &'a str>

Source

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)

Source

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)

Source§

impl<K, P, V> Config<K, P, V>
where K: Eq + Hash + AsRef<OsStr>, P: Into<PathBuf>, V: AsRef<OsStr>,

Source

pub fn new() -> Self

Creates a new blank configuration without type parameter assumptions

Source

pub fn from_hash_map(options: HashMap<K, V>) -> Self

Creates a new configuration from the given HashMap of options with no type assumptions

Source

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

Source

pub fn edition(self, edition: Edition) -> Self

Set the Rust edition of the source input (RustFmt only, ignored by PrettyPlease)

Source

pub fn post_proc(self, post_proc: PostProcess) -> Self

Set the post processing option after formatting (used by both RustFmt and PrettyPlease)

Source

pub fn option(self, key: K, value: V) -> Self

Set a key/value pair option (RustFmt only, ignored by PrettyPlease). See here for a list of possible options

Trait Implementations§

Source§

impl<K, P, V> Clone for Config<K, P, V>
where K: Eq + Hash + AsRef<OsStr> + Clone, P: Into<PathBuf> + Clone, V: AsRef<OsStr> + Clone,

Source§

fn clone(&self) -> Config<K, P, V>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<K, P, V> Debug for Config<K, P, V>
where K: Eq + Hash + AsRef<OsStr> + Debug, P: Into<PathBuf> + Debug, V: AsRef<OsStr> + Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<K, P, V> Default for Config<K, P, V>
where K: Eq + Hash + AsRef<OsStr> + Default, P: Into<PathBuf> + Default, V: AsRef<OsStr> + Default,

Source§

fn default() -> Config<K, P, V>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<K, P, V> Freeze for Config<K, P, V>
where P: Freeze,

§

impl<K, P, V> RefUnwindSafe for Config<K, P, V>

§

impl<K, P, V> Send for Config<K, P, V>
where P: Send, K: Send, V: Send,

§

impl<K, P, V> Sync for Config<K, P, V>
where P: Sync, K: Sync, V: Sync,

§

impl<K, P, V> Unpin for Config<K, P, V>
where P: Unpin, K: Unpin, V: Unpin,

§

impl<K, P, V> UnwindSafe for Config<K, P, V>
where P: UnwindSafe, K: UnwindSafe, V: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.