Skip to main content

DerivePod

Derive Macro DerivePod 

Source
#[derive(DerivePod)]
Expand description

Derive macro for the Pod trait. Requires the derive feature.

#[derive(photon_ring::DerivePod, Clone, Copy)]
#[repr(C)]
struct Quote { price: f64, volume: u32 }

Derive Pod for a struct.

Requirements:

  • Must be a struct (not enum or union).
  • All fields must implement Pod.
  • The struct will be given #[repr(C)] semantics (the macro adds Clone and Copy derives and the unsafe impl Pod).

§Example

#[derive(photon_ring::Pod)]
struct Tick {
    price: f64,
    volume: u32,
    _pad: u32,
}