Crates.io | noir_macros_core |
lib.rs | noir_macros_core |
version | 1.1.1 |
source | src |
created_at | 2024-11-22 00:36:49.638718 |
updated_at | 2024-11-22 04:48:42.572052 |
description | Essential proc-macros and utilities for no_std Rust development |
homepage | |
repository | https://github.com/Victor-Viicell/noir_macros_core.git |
max_upload_size | |
id | 1456847 |
size | 41,822 |
Essential procedural macros and utilities for no_std Rust development, part of the Noir Framework. This crate provides zero-dependency, thread-safe utilities designed specifically for embedded and no_std environments.
StaticCell
print!
macroformat!
macroprint!
macroBuffer
typeAdd this to your Cargo.toml
:
[dependencies]
noir_macros_core = "1.1.2"
use noir_macros_core::format;
// Basic formatting
let name = "World";
let greeting = format!("Hello, {}!", name);
// Complex formatting with multiple arguments
let count = 42;
let value = 3.14;
let result = format!("Count: {}, Value: {:.2}", count, value);
use noir_macros_core::static_cell;
// Thread-safe static configuration
static_cell!(CONFIG, &str);
fn init() {
if CONFIG.try_init("production") {
// Successfully initialized
}
if let Some(config) = CONFIG.get() {
println!("Current config: {}", config);
}
}
use noir_macros_core::{const_assert_size, const_assert_align};
#[repr(C)]
struct CriticalData {
flags: u32, // 4 bytes
active: bool, // 1 byte
_pad: [u8; 3], // 3 bytes padding
}
const_assert_size!(CriticalData, 8); // Ensure total size
const_assert_align!(CriticalData, 4); // Ensure alignment
We welcome contributions! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.