rust多文件组织

mod foo;
mod bar;

fn main() {
    println!("调用 foo: {}", foo::message());
    println!("调用 bar: {}", bar::info());
}

  

pub fn message() -> String {
    "Hello from foo".to_string()
}

  

pub fn info() -> String {
    "Hello from bar".to_string()
}

  

posted @ 2026-08-10 10:44  华腾智算  阅读(3)  评论(0)    收藏  举报
https://damo.alibaba.com/ https://tianchi.aliyun.com/course?spm=5176.21206777.J_3941670930.5.87dc17c9BZNvLL