Struct rustwide::WorkspaceBuilder
source · pub struct WorkspaceBuilder { /* private fields */ }
Expand description
Builder of a Workspace
.
Implementations§
source§impl WorkspaceBuilder
impl WorkspaceBuilder
sourcepub fn new(path: &Path, user_agent: &str) -> Self
pub fn new(path: &Path, user_agent: &str) -> Self
Create a new builder.
The provided path will be the home of the workspace, containing all the data generated by rustwide (including state and caches).
sourcepub fn sandbox_image(self, image: SandboxImage) -> Self
pub fn sandbox_image(self, image: SandboxImage) -> Self
Override the image used for sandboxes.
By default rustwide will use the ghcr.io/rust-lang/crates-build-env/linux-micro image on Linux systems, and rustops/crates-build-env-windows on Windows systems. Those images contain dependencies to build a large amount of crates.
sourcepub fn command_timeout(self, timeout: Option<Duration>) -> Self
pub fn command_timeout(self, timeout: Option<Duration>) -> Self
Set the default timeout of Command
, which can be overridden
with the Command::timeout
method. To disable
the timeout set its value to None
. By default the timeout is 15 minutes.
sourcepub fn command_no_output_timeout(self, timeout: Option<Duration>) -> Self
pub fn command_no_output_timeout(self, timeout: Option<Duration>) -> Self
Set the default no output timeout of Command
, which can be
overridden with the
Command::no_output_timeout
method. To
disable the timeout set its value to None
. By default it’s disabled.
sourcepub fn fast_init(self, enable: bool) -> Self
pub fn fast_init(self, enable: bool) -> Self
Enable or disable fast workspace initialization (disabled by default).
Fast workspace initialization will change the initialization process to prefer initialization speed to runtime performance, for example by installing the tools rustwide needs in debug mode instead of release mode. It’s not recommended to enable fast workspace initialization with production workloads, but it can help in CIs or other automated testing scenarios.
sourcepub fn fetch_registry_index_during_builds(self, enable: bool) -> Self
Available on crate feature unstable
only.
pub fn fetch_registry_index_during_builds(self, enable: bool) -> Self
unstable
only.Enable or disable fetching the registry’s index during each build (enabled by default).
When this option is disabled the index will only be fetched when the workspace is initialized, and no following build do that again. It’s useful to disable it when you need to build a lot of crates in a batch, but having the option disabled might cause trouble if you need to build recently published crates, as they might be missing from the cached index.
sourcepub fn running_inside_docker(self, inside: bool) -> Self
pub fn running_inside_docker(self, inside: bool) -> Self
Enable or disable support for running Rustwide itself inside Docker (disabled by default).
When support is enabled Rustwide will try to detect whether it’s actually running inside a Docker container during initialization, and in that case it will adapt itself. This is needed because starting a sibling container from another one requires mount sources to be remapped to the real directory on the host.
Other than enabling support for it, to run Rustwide inside Docker your container needs to meet these requirements:
- The Docker socker (
/var/run/docker.sock
) needs to be mounted inside the container. - The workspace directory must be either mounted from the host system or in a child directory of a mount from the host system. Workspaces created inside the container are not supported.
sourcepub fn rustup_profile(self, profile: &str) -> Self
pub fn rustup_profile(self, profile: &str) -> Self
Name of the rustup profile used when installing toolchains. The default is minimal
.