pub struct Measure { /* private fields */ }

Implementations§

Measure this function

Use Measure::this() when you have a function that you want to measure. this() will start a new Measure, call your function, stop the measure, then return the Measure object along with your function’s return value.

If your function takes more than one parameter, you will need to wrap your function in a closure, and wrap the arguments in a tuple. The same thing applies to methods. See the tests for more details.

Examples
// Call a function with a single argument
let (result, measure) = Measure::this(my_function, 42, "my_func");
// Call a function with multiple arguments
let (result, measure) = Measure::this(|(arg1, arg2)| std::cmp::min(arg1, arg2), (42, 123), "minimum");
// Call a method
let foo = Foo { x: 42 };
let (result, measure) = Measure::this(|(this, args)| Foo::bar(&this, args), (&foo, baz), "Foo::bar");

Trait Implementations§

Formats the value using the given formatter. Read more
Formats the value using the given formatter. 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

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 alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Should always be Self
Converts the given value to a String. 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.