Skip to main content

nadir/
frame_allocs.rs

1// Copyright 2026 Joseph Anthony Abbott III
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! [`FrameAllocs`]: what each frame allocated, in development builds.
16
17use nadir_platform::AllocCounts;
18
19/// What the main thread allocated in the last frame: a resource of
20/// development builds (feature `dev`).
21///
22/// A frame counts from the end of the one before it to its own end: the
23/// wait for it, its events, its ticks, the frame systems, the drawing and
24/// the asset loading. A frame system reads the frame before its own. A
25/// steady frame should allocate nothing.
26///
27/// Only Rust's global allocator is counted, not what C libraries such as
28/// the GPU driver allocate themselves.
29#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
30pub struct FrameAllocs(pub AllocCounts);