Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Raphaël Gomès
micro-timer
Commits
6bf5baf7318b
Commit
623b6af0
authored
Mar 23, 2020
by
Raphaël Gomès
Browse files
Version 0.2.1
Documentation and comment fixes
parent
a38af0076ed2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Cargo.lock
View file @
6bf5baf7
...
...
@@ -37,16 +37,16 @@ dependencies = [
[[package]]
name = "micro-timer"
version = "0.2.
0
"
version = "0.2.
1
"
dependencies = [
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"micro-timer-macros 0.2.
0
",
"micro-timer-macros 0.2.
1
",
"scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "micro-timer-macros"
version = "0.2.
0
"
version = "0.2.
1
"
dependencies = [
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"pretty_assertions 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
...
...
Cargo.toml
View file @
6bf5baf7
...
...
@@ -5,7 +5,7 @@ name = "micro-timer"
description
=
"Dumb tiny logging timer"
license-file
=
"LICENCE"
readme
=
"README.md"
version
=
"0.2.
0
"
version
=
"0.2.
1
"
authors
=
[
"Raphaël Gomès <rgomes@octobus.net>"
]
edition
=
"2018"
homepage
=
"https://heptapod.octobus.net/Alphare/micro-timer"
...
...
README.md
View file @
6bf5baf7
...
...
@@ -8,7 +8,7 @@ In ``Cargo.toml``:
```
toml
[dependencies]
micro-timer
=
"0.
1.2
"
micro-timer
=
"0.
2.1
"
log
=
"0.4.8"
```
...
...
libs/micro-timer-macros/Cargo.toml
View file @
6bf5baf7
...
...
@@ -3,7 +3,7 @@ name = "micro-timer-macros"
description
=
"Macros for the micro-timer crate"
license-file
=
"LICENCE"
readme
=
"README.md"
version
=
"0.2.
0
"
version
=
"0.2.
1
"
authors
=
[
"Raphaël Gomès <rgomes@octobus.net>"
]
edition
=
"2018"
homepage
=
"https://heptapod.octobus.net/Alphare/micro-timer"
...
...
libs/micro-timer-macros/src/lib.rs
View file @
6bf5baf7
...
...
@@ -45,9 +45,6 @@ fn inner_timed(_attr_ts: TokenStream, fn_ts: TokenStream) -> TokenStream {
.collect
();
let
span
=
outer
.sig.ident
.span
();
// We use `__micro_timer_inner` as a name in case it pops up in error
// messages to make it obvious that it's an issue caused by this crate,
// it is not meant to prevent name collision.
let
block
=
quote_spanned!
{
span
=>
{
...
...
@@ -101,16 +98,17 @@ mod tests {
let
expected
:
TokenStream
=
syn
::
parse_quote!
{
fn
my_super_function
(
_value
:
usize
)
->
usize
{
let
__micro_timer_instant
=
::
std
::
time
::
Instant
::
now
();
::
micro_timer
::
scopeguard
::
guard_on_success
(
__micro_timer_instant
,
|
timer
|
{
crate
::
log
::
trace!
(
"Duration of `{}`: {:?}"
,
"my_super_function"
,
timer
.elapsed
()
);
}
);
let
__micro_timer_guard
=
::
micro_timer
::
scopeguard
::
guard_on_success
(
__micro_timer_instant
,
|
timer
|
{
crate
::
log
::
trace!
(
"Duration of `{}`: {:?}"
,
"my_super_function"
,
timer
.elapsed
()
);
}
);
let
timer
=
10
;
timer
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment