To practice crates in Rust, i decided to create a library which contains info about different species of snails, and there is a problem: i can't create a variable using let keyword. Should i place the variable into some function, or are there any ways to create a variable out of function? Or should i make functions which returns info about some species instead of variables (for example. nor fulica,but fulica()). I don't like an idea about making the species functions because Snails::species::Achatina::fulica seems more convinient than Snails::species::Achatina::fulica()
mod species{
pub struct Animal {
Superorder: String, Order: String, Suborder:String,Superfamily:String,Family:String,Genus:String,Specie:String
}
pub struct SnailInfo{
size:(i32,i32), general_info:String,inhabitation:String, full_name: String, zoological:Animal
}
mod Achatina{
let fulica = SnailInfo{
size:(12,20),general_info: "Also wnown as giant african land snail, Achatina Fulica is one of the most invasive animals in the world. It originates from the Eastern Africa, but you can find them in the Asia, North America, South America and Australia",
inhabitation: "Africa, Asia, North America, South America, Australia and some islands", full_name: "Lissachatina fulica",zoological:{Suprorder:Eupelmonata,Order:"Stylomatophora",Suborder:"Achatina",
Superfamily:"Achatinoidae",Family:"Achatinoidae",Genus:"Lissachatina",Specie:"Lissachatina Fulica"}
}
let reticulata = SnailInfo{
size:(15,25), general_info:"Eatern African snail known for its fast speed of growing and the black head.",inhabitation:"Mostly Zanzibar",full_name:"Achatina Reticulata",
}
}
Error: | 9 | let fulica = SnailInfo{ | ^^^ expected item
P.S. I undestand, that there are many other mistakes in this piece of code, but i'll improve them myself