pub enum VariableAnnotation {
NonNull,
ReadOnly,
WriteOnly,
Align(u32),
Sensitive,
Register(String),
Unused,
}Expand description
Attributes that can be applied to function parameters and variables.
Variants§
NonNull
Mark this parameter as non-null (never accepts null pointers).
This lets the compiler optimize away null checks and enables more aggressive optimizations for pointer operations.
ReadOnly
Mark this parameter as read-only (not modified by the function).
Read-only parameters can be passed by reference without copying, and the compiler can optimize based on the immutability guarantee.
WriteOnly
Mark this parameter as write-only (only written to, never read from).
Write-only parameters are typically used for output parameters. The compiler can optimize away reads from these parameters.
Align(u32)
Specify the alignment requirement for this parameter in bytes.
Parameter alignment affects how the parameter is passed and stored. This can improve performance on some architectures.
Sensitive
Mark this parameter as sensitive (contains security-critical data).
Sensitive parameters may receive special treatment such as avoiding storage in registers or zeroing them after use.
Register(String)
Specify that this parameter should be passed in a specific register.
Register assignment can improve performance but reduces flexibility. Only use when you know the target ABI well.
Unused
Mark this parameter as unused (not used by the function).
Unused parameters may be optimized away or may indicate API compatibility.
Trait Implementations§
Source§impl Clone for VariableAnnotation
impl Clone for VariableAnnotation
Source§fn clone(&self) -> VariableAnnotation
fn clone(&self) -> VariableAnnotation
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more