4

In Scrypto, I have folder structure like:

src/
├── lib.rs
├── script.rs
├── custom_types
│   └── type.rs

In type.rs, I have the following defined:


use sbor::*;

#[derive(TypeId, Encode, Decode, Describe)]
pub struct Date {
    year: u8,
    day: u8,
    month: u8,
}

I want to be able to use the Date struct in script.rs how do I do it?

Mikko Ohtamaa
  • 82,057
  • 50
  • 264
  • 435
M80
  • 191
  • 1
  • 14

1 Answers1

1

Organize files like:

src/
├── lib.rs
├── script.rs
├── custom_types
│   └── type.rs
│   └── mod.rs

mod.rs:

pub mod type;

Add the following to script.rs:

use super::custom_types::type::Date;

...

Finally, add the following to lib.rs

mod datatypes;
M80
  • 191
  • 1
  • 14