Struct gdnative::prelude::nativescript::profiling::Signature [−][src]
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]
F: FnOnce() -> R,
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]
pub fn hash<__H>(&self, state: &mut __H) where
__H: Hasher,
[src]
__H: Hasher,
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<'a> PartialEq<Signature<'a>> for Signature<'a>
[src]
pub fn eq(&self, other: &Signature<'a>) -> bool
[src]
pub fn ne(&self, other: &Signature<'a>) -> bool
[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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CallHasher for T where
T: Hash + ?Sized,
T: Hash + ?Sized,
pub default fn get_hash<H, B>(value: &H, build_hasher: &B) -> u64 where
B: BuildHasher,
H: Hash + ?Sized,
B: BuildHasher,
H: Hash + ?Sized,
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
pub fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,