#[non_exhaustive]pub struct MemoryScopes {
pub tag: fn(u8, &'static str) -> u16,
pub enter: fn(u16) -> u16,
pub leave: fn(u16),
}Expand description
How a backend lets the engine tag what it allocates (ADR-0046 §6):
three plain functions over its heap counter’s tags
(shuyi_platform::Platform::memory_scopes), so neither this crate nor
the platform depends on the counter. Build it with
MemoryScopes::new (ADR-0039).
With scopes in its context (Ctx::set_memory_scopes), the game’s
frame enters update and draw, each Ctx::span its own name, and
the platform’s App its own phases. Entering a tag changes nothing a
game reads.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.tag: fn(u8, &'static str) -> u16The tag of a name of a class (TagClass as a number), the same
each time it is asked for.
enter: fn(u16) -> u16Makes a tag the current one, and gives back the one before.
leave: fn(u16)Puts back the tag enter gave.
Implementations§
Source§impl MemoryScopes
impl MemoryScopes
Sourcepub const fn new(
tag: fn(u8, &'static str) -> u16,
enter: fn(u16) -> u16,
leave: fn(u16),
) -> Self
pub const fn new( tag: fn(u8, &'static str) -> u16, enter: fn(u16) -> u16, leave: fn(u16), ) -> Self
Scopes that find a tag with tag, and enter and leave it.
Trait Implementations§
Source§impl Clone for MemoryScopes
impl Clone for MemoryScopes
Source§fn clone(&self) -> MemoryScopes
fn clone(&self) -> MemoryScopes
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for MemoryScopes
Auto Trait Implementations§
impl Freeze for MemoryScopes
impl RefUnwindSafe for MemoryScopes
impl Send for MemoryScopes
impl Sync for MemoryScopes
impl Unpin for MemoryScopes
impl UnsafeUnpin for MemoryScopes
impl UnwindSafe for MemoryScopes
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more