Struct gdnative::prelude::nativescript::profiling::Signature[][src]

pub struct Signature<'a> { /* fields omitted */ }

A string encoding information about the code being profiled for Godot's built-in profiler.

The string should be in the form of {file}::{line_number}::{tag}, where tag is an identifier of the code, usually be the name of the method. None of the substrings should contain ::.

To create a Signature in the correct form, see Signature::new or profile_sig!. To create a Signature from an existing CStr or CString, see Signature::from_raw and Signature::from_raw_owned.

Implementations

impl<'a> Signature<'a>[src]

pub const fn from_raw(sig: &'a CStr) -> Signature<'a>[src]

Creates a Signature from a CStr in the specified format. The format is not checked.

Adding profiling data using an invalid Signature may cause incorrect information to show up in the editor.

pub unsafe fn from_bytes_with_nul_unchecked(bytes: &'a [u8]) -> Signature<'a>[src]

Creates a Signature from a NUL-terminated byte slice, containing a string in the specified format. Neither the format nor whether the slice is correctly NUL-terminated is checked.

This is a convenience method for Signature::from_raw(CStr::from_bytes_with_nul_unchecked(bytes)).

Adding profiling data using an invalid Signature may cause incorrect information to show up in the editor.

Safety

This function will cast the provided bytes to a CStr wrapper without performing any sanity checks. The provided slice must be nul-terminated and not contain any interior nul bytes.

pub fn borrow(&self) -> Signature<'_>[src]

Create a borrowed version of self for repeated use with add_data or profile.

pub fn add_data(&self, time: Duration)[src]

Add a data point to Godot's built-in profiler using this signature.

See the free function gdnative::nativescript::profiling::add_data.

pub fn profile<F, R>(&self, f: F) -> R where
    F: FnOnce() -> R, 
[src]

Times a closure and adds the measured time to Godot's built-in profiler with this signature, and then returns it's return value.

See the free function gdnative::nativescript::profiling::profile.

impl Signature<'static>[src]

pub fn new(file: &str, line: u32, tag: &str) -> Signature<'static>[src]

Creates a Signature in the correct form using the given variables. The format is checked at runtime.

Panics

If file or tag contain :: or NUL-bytes.

pub const fn from_raw_owned(sig: CString) -> Signature<'static>[src]

Creates a Signature from an owned CString in the specified format. The format is not checked.

Adding profiling data using an invalid Signature may cause incorrect information to show up in the editor.

Trait Implementations

impl<'a> Clone for Signature<'a>[src]

impl<'a> Debug for Signature<'a>[src]

impl<'a> Eq for Signature<'a>[src]

impl<'a> Hash for Signature<'a>[src]

impl<'a> PartialEq<Signature<'a>> for Signature<'a>[src]

impl<'a> StructuralEq for Signature<'a>[src]

impl<'a> StructuralPartialEq for Signature<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for Signature<'a>[src]

impl<'a> Send for Signature<'a>[src]

impl<'a> Sync for Signature<'a>[src]

impl<'a> Unpin for Signature<'a>[src]

impl<'a> UnwindSafe for Signature<'a>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> CallHasher for T where
    T: Hash + ?Sized

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.