Importing local modules in an evcxr Jupyter Notebook

Hello all. New to the community, so I apologize if I'm messing something up. I'm new to Jupyter Notebook and evcxr as well. Let's say I have a struct in a src/models/goodreads.rs file:

use serde::{Serialize, Deserialize};

#[derive(Serialize, Deserialize, Debug)]
pub struct Book {
    pub title: String,
    pub author: String,
    pub rating: f32,
    pub num_ratings: u64,
    pub year_published: u32,
}

How do I use that struct in a Jupyter Notebook? Obviously, if I were in another file, I would just do:

use crate::models::goodreads::Book;

But that doesn't work in a Jupyter Notebook.

I really appreciate the help! I've been hitting my head against this for a while.

Evcxr doesn't support code in external files. It only supports extern crates as dependencies and code inside the notebook itself.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.