feat: rbe 1.2.2.1: test case list w/ activity

This commit is contained in:
Nak0_x 2026-09-05 00:34:55 +02:00
parent ec8764f48d
commit 2e92e3463c
3 changed files with 42 additions and 0 deletions

View File

@ -0,0 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "list-display"
version = "0.1.0"

View File

@ -0,0 +1,6 @@
[package]
name = "list-display"
version = "0.1.0"
edition = "2024"
[dependencies]

View File

@ -0,0 +1,29 @@
// Import the `fmt` module.
use std::fmt;
// Define a structuree named `List` containing a `Vec`.
struct List(Vec<i32>);
impl fmt::Display for List {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
// Create a reference to the Vec<i32> stored in the List struct.
let vec = &self.0;
write!(f, "[")?;
// Iterate over `v` in `vec` while enumerating the iteration
// index in `index`.
for (index, v) in vec.iter().enumerate() {
if index != 0 { write!(f, ", ")?; }
write!(f, "{index}: {v}")?;
}
// Close the opend bracket and return a fmt::Result value.
write!(f, "]")
}
}
fn main() {
let v = List(vec![1, 2, 3]);
println!("{}", v);
}