{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rfcs/issues/1243","labels_url":"https://api.github.com/repos/rust-lang/rfcs/issues/1243/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rfcs/issues/1243/comments","events_url":"https://api.github.com/repos/rust-lang/rfcs/issues/1243/events","html_url":"https://github.com/rust-lang/rfcs/issues/1243","id":99704649,"number":1243,"title":"Stabilize Duration::span as-is?","user":{"login":"SimonSapin","id":291359,"avatar_url":"https://avatars.githubusercontent.com/u/291359?v=3","gravatar_id":"","url":"https://api.github.com/users/SimonSapin","html_url":"https://github.com/SimonSapin","followers_url":"https://api.github.com/users/SimonSapin/followers","following_url":"https://api.github.com/users/SimonSapin/following{/other_user}","gists_url":"https://api.github.com/users/SimonSapin/gists{/gist_id}","starred_url":"https://api.github.com/users/SimonSapin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimonSapin/subscriptions","organizations_url":"https://api.github.com/users/SimonSapin/orgs","repos_url":"https://api.github.com/users/SimonSapin/repos","events_url":"https://api.github.com/users/SimonSapin/events{/privacy}","received_events_url":"https://api.github.com/users/SimonSapin/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-08-07T18:37:17Z","updated_at":"2015-08-13T20:39:04Z","closed_at":"2015-08-13T20:39:04Z","body":"`std::time` currently contains:\r\n\r\n```rust\r\nimpl Duration {\r\n    /// Runs a closure, returning the duration of time it took to run the\r\n    /// closure.\r\n    #[unstable(feature = \"duration_span\",\r\n               reason = \"unsure if this is the right API or whether it should \\\r\n                         wait for a more general \\\"moment in time\\\" \\\r\n                         abstraction\")]\r\n    pub fn span<F>(f: F) -> Duration where F: FnOnce() {\r\n        let start = SteadyTime::now();\r\n        f();\r\n        &SteadyTime::now() - &start\r\n    }\r\n}\r\n```\r\n\r\nI’d like to stabilize this method unchanged. Even if a \"moment in time\" abstraction exists, doing the `let start = now(); do stuff; now() - start` dance gets tedious very quickly and a closure-based `Duration::span` method would still be valuable."},"comment":{"url":"https://api.github.com/repos/rust-lang/rfcs/issues/comments/130833194","html_url":"https://github.com/rust-lang/rfcs/issues/1243#issuecomment-130833194","issue_url":"https://api.github.com/repos/rust-lang/rfcs/issues/1243","id":130833194,"user":{"login":"SimonSapin","id":291359,"avatar_url":"https://avatars.githubusercontent.com/u/291359?v=3","gravatar_id":"","url":"https://api.github.com/users/SimonSapin","html_url":"https://github.com/SimonSapin","followers_url":"https://api.github.com/users/SimonSapin/followers","following_url":"https://api.github.com/users/SimonSapin/following{/other_user}","gists_url":"https://api.github.com/users/SimonSapin/gists{/gist_id}","starred_url":"https://api.github.com/users/SimonSapin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimonSapin/subscriptions","organizations_url":"https://api.github.com/users/SimonSapin/orgs","repos_url":"https://api.github.com/users/SimonSapin/repos","events_url":"https://api.github.com/users/SimonSapin/events{/privacy}","received_events_url":"https://api.github.com/users/SimonSapin/received_events","type":"User","site_admin":false},"created_at":"2015-08-13T20:39:04Z","updated_at":"2015-08-13T20:39:04Z","body":"Closing in favor of #27799."}}