pub struct ConfigBuilder { /* private fields */ }Expand description
Incrementally builds a Config by layering configuration sources.
- Call
ConfigBuilder::defaultto start with a blank slate, or callConfigBuilder::newto start from a deserialised configuration file. - Populate the fields from overriding sources (e.g. CLI arguments).
- Finish with
ConfigBuilder::build.
Implementations§
Source§impl ConfigBuilder
A builder for the lux Config.
impl ConfigBuilder
A builder for the lux Config.
Sourcepub fn new() -> Result<Self, ConfigError>
pub fn new() -> Result<Self, ConfigError>
Create a new ConfigBuilder by deserializing from a config file
if present, or otherwise by instantiating the default config.
Sourcepub fn config_file() -> Result<PathBuf, NoValidHomeDirectory>
pub fn config_file() -> Result<PathBuf, NoValidHomeDirectory>
Get the path to the lux config file.
Sourcepub fn dev(self, dev: Option<bool>) -> Self
pub fn dev(self, dev: Option<bool>) -> Self
Whether to enable development packages
Default: false
Sourcepub fn server(self, server: Option<Url>) -> Self
pub fn server(self, server: Option<Url>) -> Self
Fetch rocks/rockspecs from this luarocks server
Default: "https://luarocks.org/"
Sourcepub fn extra_servers(self, extra_servers: Option<Vec<Url>>) -> Self
pub fn extra_servers(self, extra_servers: Option<Vec<Url>>) -> Self
Fetch rocks/rockspecs from these servers in addition to the main server
Sourcepub fn lua_dir(self, lua_dir: Option<PathBuf>) -> Self
pub fn lua_dir(self, lua_dir: Option<PathBuf>) -> Self
The directory in which to install Lua if not found
Sourcepub fn lua_version(self, lua_version: Option<LuaVersion>) -> Self
pub fn lua_version(self, lua_version: Option<LuaVersion>) -> Self
Which Lua version to use. Default: The installed Lua version, if detected
Sourcepub fn variables(self, variables: Option<HashMap<String, String>>) -> Self
pub fn variables(self, variables: Option<HashMap<String, String>>) -> Self
Variable names, mapped to their values.
Lux populates variables in the lux.toml and in RockSpecs
with these before building.
Sourcepub fn verbose(self, verbose: Option<bool>) -> Self
pub fn verbose(self, verbose: Option<bool>) -> Self
Whether to display verbose output of commands executed.
Default: false
Sourcepub fn no_progress(self, no_progress: Option<bool>) -> Self
pub fn no_progress(self, no_progress: Option<bool>) -> Self
Whether to disable printing progress bars and spinners
Default: false
Sourcepub fn no_prompt(self, no_prompt: Option<bool>) -> Self
pub fn no_prompt(self, no_prompt: Option<bool>) -> Self
Whether to disable user prompts
Default: false
Sourcepub fn timeout(self, timeout: Option<Duration>) -> Self
pub fn timeout(self, timeout: Option<Duration>) -> Self
Timeout on network operations, in seconds. 0 means no timeout (wait forever). Default: 30 s
Sourcepub fn max_jobs(self, max_jobs: Option<usize>) -> Self
pub fn max_jobs(self, max_jobs: Option<usize>) -> Self
Maximum buffer size for parallel jobs, such as downloading rockspecs and installing rocks. 0 means no limit. Default: 0
Sourcepub fn cache_dir(self, cache_dir: Option<PathBuf>) -> Self
pub fn cache_dir(self, cache_dir: Option<PathBuf>) -> Self
The cache directory, e.g. for luarocks manifests.
Sourcepub fn data_dir(self, data_dir: Option<PathBuf>) -> Self
pub fn data_dir(self, data_dir: Option<PathBuf>) -> Self
The data directory, in which the default user install tree resides.
Sourcepub fn vendor_dir(self, vendor_dir: Option<PathBuf>) -> Self
pub fn vendor_dir(self, vendor_dir: Option<PathBuf>) -> Self
Specifies a directory with locally vendored sources and RockSpecs.
When building or installing a package with this flag,
Lux will fetch sources from the
Sourcepub fn entrypoint_layout(self, rock_layout: RockLayoutConfig) -> Self
pub fn entrypoint_layout(self, rock_layout: RockLayoutConfig) -> Self
The rock layout for entrypoints of new install trees. Does not affect existing install trees or dependency rock layouts.
Sourcepub fn user_agent(self, user_agent: Option<String>) -> Self
pub fn user_agent(self, user_agent: Option<String>) -> Self
The user agent to set when making web requests.
Default: “lux-lib/
Sourcepub fn generate_luarc(self, generate: Option<bool>) -> Self
pub fn generate_luarc(self, generate: Option<bool>) -> Self
Whether to generate a .luarc.json on build.
Default: true
Sourcepub fn wrap_bin_scripts(self, generate: Option<bool>) -> Self
pub fn wrap_bin_scripts(self, generate: Option<bool>) -> Self
Whether to wrap installed Lua bin scripts to be executed with
the detected or configured Lua installation.
Setting this to false disables wrapping globally.
If set to true, individual rocks can still disable wrapping of their own bin scripts.
Default: true.
pub fn build(self) -> Result<Config, ConfigError>
Trait Implementations§
Source§impl Clone for ConfigBuilder
impl Clone for ConfigBuilder
Source§fn clone(&self) -> ConfigBuilder
fn clone(&self) -> ConfigBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Default for ConfigBuilder
impl Default for ConfigBuilder
Source§fn default() -> ConfigBuilder
fn default() -> ConfigBuilder
Source§impl<'de> Deserialize<'de> for ConfigBuilder
impl<'de> Deserialize<'de> for ConfigBuilder
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<Config> for ConfigBuilder
Useful for printing the current config
impl From<Config> for ConfigBuilder
Useful for printing the current config
Auto Trait Implementations§
impl Freeze for ConfigBuilder
impl RefUnwindSafe for ConfigBuilder
impl Send for ConfigBuilder
impl Sync for ConfigBuilder
impl Unpin for ConfigBuilder
impl UnsafeUnpin for ConfigBuilder
impl UnwindSafe for ConfigBuilder
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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 moreimpl<T> OrderedSeq<'_, T> for Twhere
T: Clone,
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
Source§impl<T, S> SpanWrap<S> for Twhere
S: WrappingSpan<T>,
impl<T, S> SpanWrap<S> for Twhere
S: WrappingSpan<T>,
Source§fn with_span(self, span: S) -> <S as WrappingSpan<Self>>::Spanned
fn with_span(self, span: S) -> <S as WrappingSpan<Self>>::Spanned
WrappingSpan::make_wrapped to wrap an AST node in a span.