organizing_files

This commit is contained in:
Ahmet Kaan GÜMÜŞ 2024-01-20 14:32:47 +03:00
parent f0fe3ae8bd
commit b57a5a71f5
7 changed files with 42 additions and 0 deletions

View file

@ -0,0 +1,8 @@
[package]
name = "organizing_files"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

View file

@ -0,0 +1,2 @@
//We export duck module to use in another scope.
pub mod duck;

View file

@ -0,0 +1,3 @@
pub fn hi_from_duck() {
println!("I'm duck");
}

View file

@ -0,0 +1,3 @@
//We export gift_first and gift_second modules to use in another scope.
pub mod lake;
pub mod plain;

View file

@ -0,0 +1,21 @@
//We can call modules with use to bring them into scope
//Call them seperately
//use organizing_files::gift_first;
//use organizing_files::gift_second;
//Call them together
use organizing_files::{lake, plain};
//Call every export with "glob"
//use organizing_files::*;
fn main() {
println!("Hello, world!");
//Call duck from lake scope
lake::duck::hi_from_duck();
//Call bunny from plain scope
plain::bunny::hi_from_bunny();
}

View file

@ -0,0 +1,2 @@
//We export bunny module to use in another scope.
pub mod bunny;

View file

@ -0,0 +1,3 @@
pub fn hi_from_bunny() {
println!("I'm bunny");
}