Knowledge Garden

Search

Search IconIcon to open search

Modules in Rust

Last updated Dec 1, 2022 Edit Source

# Modules

similar to python modules

All items in libraries are private by default even to binaries in same project.

1
2
3
4
5
6
7
8
9
pub fn greet(){
	println!("hi");
}

use lib

fn main(){
	hello::greet(); //works
}

add use statement to bring into scope libraries and things. just like python.

standard library is always available

find documentation google rust standard —thing—