// SPDX-License-Identifier: GPL-2.0 //! Rust out-of-tree sample use kernel::prelude::*; module! { type: RustOutOfTree, name: b"rust_out_of_tree", author: b"Rust for Linux Contributors", description: b"Rust out-of-tree sample", license: b"GPL", } struct RustOutOfTree { numbers: Vec, } impl kernel::Module for RustOutOfTree { fn init(_module: &'static ThisModule) -> Result { pr_info!("Rust out-of-tree sample (init)\n"); let mut numbers = Vec::new(); numbers.try_push(72)?; numbers.try_push(108)?; numbers.try_push(200)?; Ok(RustOutOfTree { numbers }) } } impl Drop for RustOutOfTree { fn drop(&mut self) { pr_info!("My numbers are {:?}\n", self.numbers); pr_info!("Rust out-of-tree sample (exit)\n"); } }