Struct solana_measure::measure::Measure[][src]

pub struct Measure { /* fields omitted */ }

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, fizz, "my_func");
// Call a function with multiple arguments
let (result, measure) = Measure::this(|(arg1, arg2)| my_function(arg1, arg2), ("abc", 123), "my_func");
/// Call a method
struct Foo { ...  }
impl Foo { fn bar(&self, some_arg: i32) { ... } }

let foo = Foo { };
let (result, measure) = Measure::this(|this, arg| Foo::bar(&this, arg), (&foo, arg), "bar");

Trait Implementations

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

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

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.