Skip to main content

Lap

Struct Lap 

Source
pub struct Lap { /* private fields */ }
Expand description

一段计时的把手(DT-04 构建期裁剪的唯一入口)。

profiling 关闭时它是个空元组结构:Lap::start() 不读时钟、 elapsed_ns() 直接返回常量 0,于是 run_frame 里那 5 对读表在优化后彻底消失。 之所以做成类型而不是在每个调用点写 #[cfg]:那样会留下 5 处分叉, 而“采集开没开“这件事只该有一个答案(就是这个结构)。

Implementations§

Source§

impl Lap

Source

pub fn start() -> Self

取表起点。关闭 profiling 时不读时钟。

Source

pub fn elapsed_ns(&self) -> u64

到这里为止的耗时(纳秒)。关闭 profiling 时恒 0。

Trait Implementations§

Source§

impl Clone for Lap

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Lap

Source§

impl Debug for Lap

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Forget for Lap

§

impl Freeze for Lap

§

impl Move for Lap

§

impl RefUnwindSafe for Lap

§

impl Send for Lap

§

impl Sync for Lap

§

impl Unpin for Lap

§

impl UnsafeUnpin for Lap

§

impl UnwindSafe for Lap

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.