1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//! This crate is an example for the [`soa_derive`] crate functionalities. All
//! the code is generated by a single file:
//!
//! ```no_run
//! #[macro_use]
//! extern crate soa_derive;
//! # fn main() {
//!
//! /// A basic Particle type
//! #[derive(Debug, PartialEq, StructOfArray)]
//! #[soa_derive = "Debug, PartialEq"]
//! pub struct Particle {
//!     /// Mass of the particle
//!     pub mass: f64,
//!     /// Position of the particle
//!     pub position: [f64; 3],
//!     /// Kind of the particle
//!     pub kind: usize,
//!     /// Name of the particle
//!     pub name: String,
//! }
//! # }
//! ```
//!
//! [`soa_derive`]: https://github.com/lumol-org/soa-derive/

// Deny most of allow by default lints, just to be sure we don't create warning in user code.
// They are to be selectively allowed in the implementation
#![deny(absolute_paths_not_starting_with_crate, anonymous_parameters, bare_trait_objects)]
#![deny(box_pointers, missing_copy_implementations, missing_debug_implementations)]
#![deny(missing_docs, trivial_casts, trivial_numeric_casts, unreachable_pub)]
#![deny(unstable_features, unused_extern_crates, unused_import_braces, unused_labels)]
#![deny(unused_lifetimes, unused_qualifications, unused_results, variant_size_differences)]

// Other allow by default lints that need to stay allowed
#![allow(unsafe_code, single_use_lifetimes, elided_lifetimes_in_paths)]

#![deny(warnings)]

#[macro_use]
extern crate soa_derive;

/// A basic Particle type
#[derive(Debug, PartialEq, StructOfArray)]
#[soa_derive = "Debug, PartialEq"]
pub struct Particle {
    /// Mass of the particle
    pub mass: f64,
    /// Position of the particle
    pub position: [f64; 3],
    /// Kind of the particle
    pub kind: usize,
    /// Name of the particle
    pub name: String,
}