pub struct WorkspaceBuilder { /* private fields */ }
Expand description

Builder of a Workspace.

Implementations§

source§

impl WorkspaceBuilder

source

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).

source

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.

source

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.

source

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.

source

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.

source

pub fn fetch_registry_index_during_builds(self, enable: bool) -> Self

Available on crate feature 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.

source

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.
source

pub fn rustup_profile(self, profile: &str) -> Self

Name of the rustup profile used when installing toolchains. The default is minimal.

source

pub fn init(self) -> Result<Workspace, Error>

Initialize the workspace. This will create all the necessary local files and fetch the rest from the network. It’s not unexpected for this method to take minutes to run on slower network connections.

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.