How to add already built rust library into cargo build? -
I have a project, let's call this project master. These master projects depend on other libraries which I have already written and which have separated into separate projects, let's call this project library.
Adding GIT dependencies or adding project dependencies in the battle is very simple but if I want to choose the library I already created, then using the cargo to compile it while compiling master (output master.x) For this, I can ship the entire program with hierarchy in this way:
- Master - Library --- Library.Libras --Master.exe Is this carriage Can be used with, or with I-L parameter to use rustc? If so, how exactly? Thanks for any useful ideas.
Cargo usually puts the main src folder src < / Em>, so I will believe where it is. Your Cargo.toml file will appear in the master folder (this will be at root / src):
[package] name = "master" version = "0.0" .1 "Writers = [" You "] [Dependencies. You can get source code for your project master at library_lib] path = "src / lib" then / src . Enter another Cargo.toml file for your library in / src / lib : [package] name = "library_lib" version = "0.0.1" authors = [Finally your / src and / src / click on "you"] [lib] name = "library_lib" path = "lib.rs" ; Use library_lib: some_to_import_from_lib; This is where you refer to the crate and give details of your use, so that you can use the material from Lib.
In / src / lib / lib
Comments
Post a Comment