workspace_root

Crates.ioworkspace_root
lib.rsworkspace_root
version0.2.0
created_at2025-02-22 09:24:44.979902+00
updated_at2025-08-22 05:24:10.476198+00
descriptionA utility to get workspace root
homepagehttps://github.com/alpheusday/workspace_root.rs
repositoryhttps://github.com/alpheusday/workspace_root.rs
max_upload_size
id1565254
size34,265
Alpheus (alpheusmtx)

documentation

README

Workspace Root

A utility to get workspace root.

The functions will try to get the workspace root by searching for the Cargo.lock file. Then it will return the directory that contains the file. If the file is not found, an error will be returned instead.

Usage

Get workspace root with the following code:

use std::path::PathBuf;

use workspace_root::get_workspace_root;

let root: PathBuf = get_workspace_root();

Async version also available with async_std, smol and tokio features:

// This is a `async_std` example

use async_std::path::PathBuf;

use workspace_root::async_std::get_workspace_root_async;

let root: PathBuf = get_workspace_root_async().await;
// This is a `smol` example

use std::path::PathBuf;

use workspace_root::smol::get_workspace_root_async;

let root: PathBuf = get_workspace_root_async().await;
// This is a `tokio` example

use std::path::PathBuf;

use workspace_root::tokio::get_workspace_root_async;

let root: PathBuf = get_workspace_root_async().await;

License

This project is licensed under the terms of the MIT license.

Commit count: 20

cargo fmt