mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 09:44:59 +00:00
refactor: move remaining language examples to fixture files
This commit is contained in:
parent
44ceb8f1a0
commit
8c218e9edc
6 changed files with 89 additions and 0 deletions
33
tests/fixtures/languages/rust/test.rs
vendored
Normal file
33
tests/fixtures/languages/rust/test.rs
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
// Define a trait
|
||||
trait Greeting {
|
||||
fn greet(&self) -> String;
|
||||
}
|
||||
|
||||
// Define a struct
|
||||
struct Person {
|
||||
name: String,
|
||||
age: u32,
|
||||
}
|
||||
|
||||
// Implement the trait for Person
|
||||
impl Greeting for Person {
|
||||
fn greet(&self) -> String {
|
||||
format!("Hello, {}! You are {} years old.", self.name, self.age)
|
||||
}
|
||||
}
|
||||
|
||||
// Implementation block for Person
|
||||
impl Person {
|
||||
fn new(name: String, age: u32) -> Self {
|
||||
Person { name, age }
|
||||
}
|
||||
}
|
||||
|
||||
// Constants
|
||||
const DEFAULT_NAME: &str = "World";
|
||||
const MAX_AGE: u32 = 150;
|
||||
|
||||
fn main() {
|
||||
let person = Person::new(DEFAULT_NAME.to_string(), 30);
|
||||
println!("{}", person.greet());
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue