rust: function

///file: nestd.rs
///ide: RustRover 233.8264.22
///
///
///
/**
 *自定义函数
 */
pub fn function() {
    println!("called `my::nested::function()`");
}
 
#[allow(dead_code)]
fn private_function() {
    println!("called `my::nested::private_function()`");
}
 
 
 
///file: naccessible.rs
///ide: RustRover 233.8264.22
///
///
///
/**
 *
 */
#[allow(dead_code)]
pub fn public_function() {
    println!("called `my::inaccessible::public_function()`");
}
 
/**
 * 自定义涵数(方法)
 */
pub fn geovindu_fuction()
{
    println!("hi,geovindu,塗聚文");
 
}
 
 
 
///file: Tujuwen.rs
///ide: RustRover 233.8264.22
///
///
/**
 *中文显示
 */
pub fn display()
{
    println!("hi, I am geovindu,我是塗聚文");
}
 
 
///file: Du.rs
///ide: RustRover 233.8264.22
///
 
pub mod inaccessible; //公用,另外文件才可以调用,否则,成了私有
pub mod nested;
 
pub mod Tujuwen;
 
/**
 *公有自定池数
 */
pub fn function() {
    println!("called `my::function()`");
}
/**
 *私有 自定池数
 */
fn private_function() {
    println!("called `my::private_function()`");
}
/**
 *公有自定池数
 */
pub fn indirect_access() {
    print!("called `my::indirect_access()`, that\n> ");
 
    private_function();
}
 
 
///file: main.rs
///ide: RustRover 233.8264.22
///
mod du;
 
/**
 * 输出
 */
fn main() {
    println!("Hello, rust world!,涂聚文 ,Geovin Du");
 
    let numbers: [u8; 10] = [1, 2, 3, 4, 5, 7, 8, 9, 10, 11];
    let floats = [0.1f64, 0.2, 0.3];
 
    println!("Number: {}", numbers[5]);
    println!("Float: {}", floats[2]);
 
    du::function();
    du::indirect_access();
    du::inaccessible::geovindu_fuction();
    du::nested::function();
 
    du::Tujuwen::display();
 
 
}

rust: function_第1张图片

rust: function_第2张图片

你可能感兴趣的:(rust,rust)