Find unknown type in new struct

Hi, I just started learning rust and I'm struggling finding the right type when I create a new struct.

I use an extern crate (tract) where I successfully import a model:

let mut model = tract_tensorflow::tensorflow().model_for_path("mobilenet_v2_1.4_224_frozen.pb")?;

Now I want to create a struct Model with the fields model and model_name the following way:

struct Model {
            model: tract_core::model::model::ModelImpl,
            model_name: String,
        }


    let mut model1 = Model {
        model: tract_tensorflow::tensorflow().model_for_path("mobilenet_v2_1.4_224_frozen.pb")?,
        model_name: String::from("model_1"),
    };
    
    let mut model = model1.model;

My question is how to figure out the field type of model. Since I have to define it I created an error with a obvious wrong type to get the message that the type should be tract_core::model::model::ModelImpl. When I run the code above I get an error that the module model is private.
How can I find the correct type?

Thanks for any hints!

A search of the docs gives the answer. It's annoying that when a struct is defined in a private module and then exported publicly elsewhere the error messages point you at a type path that you can't use.

1 Like

thank you @droundry. It solves the error described above but I get another error where it's unclear what type arguments are needed.

**error[E0107]** **: wrong number of type arguments: expected 2, found 0**

**-->** examples/tensorflow-mobilenet-v2/src/main.rs:8:20

**|**

**8** **|** model: tract_core::model::ModelImpl,

**|** **^^^^^^^^^^^^^^^^^^^^^^^^^^^^** **expected 2 type arguments**

I also tried to use a generic type <T, T>, without success.

I can see that tract_core::model::ModelImpl is generic, and that you need to understand the two types in order to use it, but don't have time to learn the library myself.

Of course. Thanks for guiding me in the right direction!