0

I'm using the epub crate on version 1.2.3 and my Cargo.toml is formatted as such

[package]
name = "cl-epub-reader"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
epub = "1.2.22"

and my main.rs is

use epub::doc::EpubDoc;
use epub::doc::NavPoint;
use std::env::args;

fn main() {
    let args: Vec<String> = args().collect();
    let doc = EpubDoc::new(&args[1]).unwrap();
//    assert!(doc.is_ok());
    println!("{:?}", doc.mdata("title"));
}

All it does is get the uses the path from the a user input then it gets the title metadata and printing it.

When I run cargo run it outputs an error about an error about going out of range, which is expected however when I run rustc src/main.rs the error is error[E0433]: failed to resolve: maybe a missing crate `epub`? Does anyone know the cause of this and how to solve this issue?

1 Answer 1

3

When you call rustc directly, you need to pass the appropriate options to tell the compiler where the crates are installed on your computer. cargo handles that automatically for you (you can use the -v option to cargo build to see the actual rustc command lines it uses).

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

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.