| 1 |
//! Example usage of the `link-section` crate. |
| 2 |
#![warn(missing_docs)] |
| 3 |
|
| 4 |
use link_section::{in_section, section}; |
| 5 |
|
| 6 |
#[section(typed)] |
| 7 |
static DATA_SECTION: link_section::TypedSection<&'static (dyn std::fmt::Debug + Sync)>; |
| 8 |
|
| 9 |
/// A dynamic item in the `DATA_SECTION` section. |
| 10 |
#[in_section(DATA_SECTION)] |
| 11 |
pub static DATA_ITEM_VEC: &'static (dyn std::fmt::Debug + Sync) = &Vec::<u32>::new(); |
| 12 |
|
| 13 |
/// A string item in the `DATA_SECTION` section. |
| 14 |
#[in_section(DATA_SECTION)] |
| 15 |
pub static DATA_ITEM_STRING: &'static (dyn std::fmt::Debug + Sync) = &String::new(); |
| 16 |
|
| 17 |
fn main() { |
| 18 |
eprintln!("DATA_ITEM: {:?}", DATA_SECTION.as_slice()); |
| 19 |
} |