{"id":16949499,"url":"https://github.com/tailhook/tk-easyloop","last_synced_at":"2025-10-30T09:08:47.336Z","repository":{"id":57669987,"uuid":"78226552","full_name":"tailhook/tk-easyloop","owner":"tailhook","description":"Thread-local loop and other simplifications for tokio loop","archived":false,"fork":false,"pushed_at":"2017-01-30T13:53:45.000Z","size":13,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-25T16:16:03.771Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://docs.rs/tk-easyloop/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tailhook.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-06T17:52:01.000Z","updated_at":"2023-03-29T19:55:12.000Z","dependencies_parsed_at":"2022-09-26T20:40:41.164Z","dependency_job_id":null,"html_url":"https://github.com/tailhook/tk-easyloop","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tailhook%2Ftk-easyloop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tailhook%2Ftk-easyloop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tailhook%2Ftk-easyloop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tailhook%2Ftk-easyloop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tailhook","download_url":"https://codeload.github.com/tailhook/tk-easyloop/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248208548,"owners_count":21065202,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T21:55:02.042Z","updated_at":"2025-10-30T09:08:47.252Z","avatar_url":"https://github.com/tailhook.png","language":"Rust","readme":"===============\nTokio Easy Loop\n===============\n\n:Status: Beta\n:Documentation: http://docs.rs/tk-easyloop/\n\nA main loop wrapper around tokio to provide thread-local\nloop which:\n\n* Avoids padding a ``Handle`` in to every function\n* Mostly avoids common error: ``thread 'foo' panicked at 'no Task is\n  currently running'``, by providing convenient `run` function for all your\n  code involving futures\n\n\nExample\n=======\n\n.. code-block:: rust\n\n    extern crate futures;\n    extern crate tk_easyloop;\n\n    use std::time::Duration;\n    use tk_easyloop::{run, timeout};\n\n    fn main() {\n        run(|| {\n            // should return some future, let's use a timeout\n            timeout(Duration::new(1, 0))\n        }).unwrap();\n    }\n\n\nMulti-threaded Example\n======================\n\nThis crate uses thread-local storage for storing loop, but it doesn't\nmean multi-treading doesn't work. Multiple threads can be used too.\n\n.. code-block:: rust\n\n    extern crate tk_easyloop;\n    use std::thread;\n    use std::time::Duration;\n    use tk_easyloop::{run, timeout};\n\n    fn main() {\n        let mut threads = Vec::new();\n        for thread_no in 0..10 {\n            threads.push(thread::spawn(move || {\n                run(|| {\n                    timeout(Duration::new(1, 0))\n                })\n            }))\n        }\n        for t in threads {\n            t.join().unwrap().unwrap();\n        }\n    }\n\nSee ``examples/multi-threaded.rs`` for more comprehensive example.\n\n\nLicense\n=======\n\nLicensed under either of\n\n* Apache License, Version 2.0,\n  (./LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)\n* MIT license (./LICENSE-MIT or http://opensource.org/licenses/MIT)\n  at your option.\n\nContribution\n------------\n\nUnless you explicitly state otherwise, any contribution intentionally\nsubmitted for inclusion in the work by you, as defined in the Apache-2.0\nlicense, shall be dual licensed as above, without any additional terms or\nconditions.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftailhook%2Ftk-easyloop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftailhook%2Ftk-easyloop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftailhook%2Ftk-easyloop/lists"}