2

I want to clone the tokio library and make a few changes to it, then use it in another project, just like I would if I had specified tokio as a dependency in my Cargo.toml.

How would I go about doing that?

2 Answers 2

6

You could use a path dependency for this. Paths are interpreted as relative to the Cargo.toml they appear in, so you have a few options:

Have your tokio fork as a subdirectory tokio in your project, or symlinked there:

[dependencies]
tokio = { path = "tokio" }

Have your tokio fork live somewhere else in your home directory:

[dependencies]
tokio = { path = "/home/youruser/tokio-fork" }

Or wherever else makes the most sense for you.

Sign up to request clarification or add additional context in comments.

1 Comment

I found this link in related questions, it answered it all.
3

As an alternative, if instead of local dev, you want to use git, you could fork the repo an use reference it:

tokio = { git = "https://github.com/your-user/tokio" }

Take a look at the documentation on how to specify dependencies

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.