pub struct Signature<'a> { /* private fields */ }
Expand description

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

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.

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.

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

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

See the free function profiler::add_data().

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 profiler::profile().

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.

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

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Compare self to key and return true if they are equal.

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.