{"id":29548881,"url":"https://github.com/anglesideangle/bcsc","last_synced_at":"2025-07-17T22:38:21.680Z","repository":{"id":304913149,"uuid":"1019138624","full_name":"AngleSideAngle/bcsc","owner":"AngleSideAngle","description":"borrow checked structured concurrency - experimental primitives from swiper","archived":false,"fork":false,"pushed_at":"2025-07-16T01:42:18.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-17T03:10:16.924Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AngleSideAngle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-13T20:26:50.000Z","updated_at":"2025-07-16T01:42:21.000Z","dependencies_parsed_at":"2025-07-17T08:47:35.946Z","dependency_job_id":"7c1837ef-0433-4a19-a8c7-0125718120c0","html_url":"https://github.com/AngleSideAngle/bcsc","commit_stats":null,"previous_names":["anglesideangle/bcsc"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/AngleSideAngle/bcsc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AngleSideAngle%2Fbcsc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AngleSideAngle%2Fbcsc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AngleSideAngle%2Fbcsc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AngleSideAngle%2Fbcsc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AngleSideAngle","download_url":"https://codeload.github.com/AngleSideAngle/bcsc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AngleSideAngle%2Fbcsc/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265672400,"owners_count":23808849,"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":"2025-07-17T22:38:17.278Z","updated_at":"2025-07-17T22:38:21.671Z","avatar_url":"https://github.com/AngleSideAngle.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"I will make no_std no_alloc stack allocated async work.\n\n\u003e What does bcsc stand for?\n\nBorrow checked structured concurrency\n\nNormal rust async is borrow checked, but this uses lifetimes (as opposed to spamming ref counting) to enforce structured concurrency in a more elegant, performant, and nostd compatible manner.\n\n\u003e What is wrong with you asa??\n\nI set out to build the best robotics framework in every aspect. I will do that. It's unfortunate that rust doesn't currently make it easy, but I will gladly fix the problems in rust first.\n\n\u003e Ok(())\n\n[multi-task vs intra-task concurrency](https://without.boats/blog/futures-unordered/)\n\nmulti-task concurrency extends better to parallelism\n- in my case, you can also implement thread affinity for hardware\n\n`FuturesUnordered` requires Arc (std)\n\n[scoped/non-'static futures](https://github.com/rmanoka/async-scoped)\n\nwhy this (nostd structured concurrency) is unsound/impossible to do safetly\n\n- https://tmandry.gitlab.io/blog/posts/2023-03-01-scoped-tasks/ !!\n- https://without.boats/blog/the-scoped-task-trilemma/ !!\n- https://conradludgate.com/posts/async-stack !!\n- https://cglab.ca/~abeinges/blah/everyone-poops/\n- https://sabrinajewson.org/blog/async-drop\n- https://blog.yoshuawuyts.com/the-waker-allocation-problem/\n- https://faultlore.com/blah/linear-rust/\n- https://blog.yoshuawuyts.com/linear-types-one-pager/\n\nproblem: i really want this feature, and am fine with unsound code\n\nsound options:\n[async nursery](https://github.com/najamelan/async_nursery) - still 'static and not ergonomic api, wraps `FuturesUnordered`\n[async-scoped](https://github.com/rmanoka/async-scoped) - wraps `FuturesUnordered`, stores in executor\nbetter?\nhttps://github.com/maroider/async_scoped_task/blob/master/src/lib.rs\nunsafe `async_scoped::scope_and_collect` is perfect (unsafe) but uses heap alloc\n\n[moro](https://github.com/nikomatsakis/moro) - wraps `FuturesUnordered`, relies on single threaded for invariants\n[task scope](https://docs.rs/task_scope/0.1.1/task_scope/) - scoped tasks but no drop guarantees unless blocking\nrelevant rfc for Forget\nhttps://github.com/rust-lang/rfcs/pull/3782 !!\n\noutdated tracking issue\nhttps://github.com/rust-lang/compiler-team/issues/727\n\nother similar proposal for Leak\nhttps://zetanumbers.github.io/book/myosotis.html\n\nalternate way of fixing drop issue\nhttps://github.com/Matthias247/rfcs/pull/1\n\nother relevant work/rfc tracking pr\nhttps://github.com/rust-lang/rfcs/pull/2958\n\nwhy drop?\nhttps://without.boats/blog/wakers-i/\nhttps://without.boats/blog/wakers-ii/\n\nwakers are references to a Task/whatever the executor uses to wrap and enqueue Futures\n\nsafe api: [Wake](https://doc.rust-lang.org/beta/std/task/trait.Wake.html)\nwhere `Task: Wake`, wakers are essentially `Weak\u003cTask\u003e` so they can wake the task while it exists (Weak won't get upgraded once the task goes out of scope, so this is safe)\nwhy can't there be a safe api with `Arc`?\n`\u0026dyn Wake` doesn't work because concurrency (think: joins) involves multiple wakers for the same task (unless everything is spawned instead of joined!??)\nwakers must be cloned, but clone -\u003e Self (Self vtable is unknown through `\u0026dyn Wake` pointer)\nok that explains *const (), but why remove the lifetimes?\nnot sure?? it seems like it wouldn't make a difference, most futures are static anyway for afformentioned soundness reasons\n- what if wakers are an intrusive linked list that the task traverses to cancel when dropped? (requires `!Forget`)/leak safety\n- what if wakers were `\u0026dyn Task` with no cloning, and all intra-task concurrency was moved to join handles for scoped spawns\n  - also note that stuff like join!() doesn't actually execute the specific future, the outermost task gets woken and then executes all subtasks, which return Pending if they aren't ready\n  - intra-task concurrency is evil??\n  - still have to wait on concurrent join handles? -\u003e join handles are part of nursery/scope, which stores its own waker-per-task -\u003e subwakers/scope's wakers get called -\u003e scope queues relevant tasks -\u003e call higher level task waker\nthere is no way to make existing `RawWaker`/`AtomicWaker` api safe because it cannot be \"invalidated\"?\n\n## What is this project?\n\nNew async primitives that disallow intra-task concurrency, clone of `futures` and `futures-concurrency` for the new primitives.\n\n## TODO:\n- [x] ScopedFuture\n- [ ] static combinators (Join Race etc), see futures-concurrency\n- [ ] `#[bsync]` or some compiler ScopedFuture generation\n- [ ] growable combinators (eg. `FutureGroup`, `FuturesUnordered`) (require alloc?)\n- [ ] unsound (needs `Forget`) multithreading\n- [ ] \"rethinking async rust\"\n- [ ] all of the above for streams\n- [ ] rfc?\n\nchannels: need lifetimed receievers, probably needs `Forget` (arc-like channels would be unsafe)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanglesideangle%2Fbcsc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanglesideangle%2Fbcsc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanglesideangle%2Fbcsc/lists"}