The #[cfg(target_pointer_width = "64")]
from the cfg section in the Rust reference seems like a likely solution. It is based on the size of a pointer (as well as isize
and usize
), which should correspond to the architecture.
More Related Contents:
- Why is a trait not implemented for a type that clearly has it implemented?
- How can I include a module from another file from the same project?
- What does “Sized is not implemented” mean?
- Deriving a trait results in unexpected compiler error, but the manual implementation works
- How do I implement Copy and Clone for a type that contains a String (or any type that doesn’t implement Copy)?
- Mutably borrow one struct field while borrowing another in a closure
- What makes something a “trait object”?
- Change enum variant while moving the field to the new variant
- When is it useful to define multiple lifetimes in a struct?
- Can I write an Iterator that mutates itself and then yields a reference into itself?
- How to update-or-insert on a Vec?
- How do I include the end value in a range?
- How do I specify lifetime parameters in an associated type?
- How do I invoke a system command and capture its output?
- How to return a string (or similar) from Rust in WebAssembly?
- What is the difference between Copy and Clone?
- Is it possible to have stack allocated arrays with the size determined at runtime in Rust?
- How to format output to a byte array with no_std and no allocator?
- What is the right way to allocate data to pass to an FFI call?
- Sharing a struct with trait objects as properties across threads
- Read large files line by line in Rust [duplicate]
- Why is it discouraged to accept a reference &String, &Vec, or &Box as a function argument?
- What makes `impl Trait` as an argument “universal” and as a return value “existential”?
- How to represent shared mutable state?
- How can I pull data out of an Option for independent use?
- Mutable self while reading from owner object
- Can Cargo download and build dependencies without also building the application?
- Why does the Rust compiler request I constrain a generic type parameter’s lifetime (error E0309)?
- Cannot pass self as callback parameter due to double borrowing
- How do I create a HashMap with type erased keys?