{"id":15401100,"url":"https://github.com/sunfishcode/atomic-dbg","last_synced_at":"2025-04-15T22:30:42.132Z","repository":{"id":40482342,"uuid":"488766100","full_name":"sunfishcode/atomic-dbg","owner":"sunfishcode","description":"Atomic `dbg`/`eprintln`/`eprint` macros","archived":false,"fork":false,"pushed_at":"2025-03-06T20:21:00.000Z","size":26,"stargazers_count":17,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-13T10:54:58.075Z","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":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sunfishcode.png","metadata":{"files":{"readme":"README.md","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,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2022-05-04T22:57:55.000Z","updated_at":"2025-03-06T20:21:04.000Z","dependencies_parsed_at":"2024-02-09T02:47:24.052Z","dependency_job_id":null,"html_url":"https://github.com/sunfishcode/atomic-dbg","commit_stats":{"total_commits":19,"total_committers":1,"mean_commits":19.0,"dds":0.0,"last_synced_commit":"cc134c31e6182b7805f1b10e09aecca0c641d3a5"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunfishcode%2Fatomic-dbg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunfishcode%2Fatomic-dbg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunfishcode%2Fatomic-dbg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunfishcode%2Fatomic-dbg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sunfishcode","download_url":"https://codeload.github.com/sunfishcode/atomic-dbg/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248997082,"owners_count":21195799,"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-01T15:56:29.103Z","updated_at":"2025-04-15T22:30:41.829Z","avatar_url":"https://github.com/sunfishcode.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# atomic-dbg\n\n\u003cp\u003e\n  \u003ca href=\"https://crates.io/crates/atomic-dbg\"\u003e\u003cimg src=\"https://img.shields.io/crates/v/atomic-dbg.svg\" alt=\"crates.io page\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://docs.rs/atomic-dbg\"\u003e\u003cimg src=\"https://docs.rs/atomic-dbg/badge.svg\" alt=\"docs.rs docs\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nThis crate provides [`dbg`], [`eprint`], and [`eprintln`], macros which work\njust like their [counterparts] [in] [std], but which:\n\n - Write atomically, up to the greatest length supported on the platform.\n - Don't use locks (in userspace) or dynamic allocations.\n - Preserve libc's `errno` and Windows' last-error code value.\n\nThis means they can be used just about anywhere within a program, including\ninside allocator implementations, inside synchronization primitives, startup\ncode, around FFI calls, inside signal handlers, and in the child process of a\n`fork` before an `exec`.\n\nAnd, when multiple threads are printing, as long as they're within the length\nsupported on the platform, the output is readable instead of potentially\ninterleaved with other output.\n\nFor example, this code:\n```rust\nuse atomic_dbg::dbg;\n\nfn main() {\n    dbg!(2, 3, 4);\n}\n```\n\nHas this strace output:\n```notrust\nwrite(2, \"[examples/dbg.rs:4] 2 = 2\\n[examples/dbg.rs:4] 3 = 3\\n[examples/dbg.rs:4] 4 = 4\\n\", 78[examples/dbg.rs:4] 2 = 2\n```\nwhich is a single atomic `write` call.\n\nFor comparison, with `std::dbg` it looks like this:\n```notrust\nwrite(2, \"[\", 1[)                        = 1\nwrite(2, \"examples/dbg.rs\", 15examples/dbg.rs)         = 15\nwrite(2, \":\", 1:)                        = 1\nwrite(2, \"4\", 14)                        = 1\nwrite(2, \"] \", 2] )                       = 2\nwrite(2, \"2\", 12)                        = 1\nwrite(2, \" = \", 3 = )                      = 3\nwrite(2, \"2\", 12)                        = 1\nwrite(2, \"\\n\", 1\n)                       = 1\nwrite(2, \"[\", 1[)                        = 1\nwrite(2, \"examples/dbg.rs\", 15examples/dbg.rs)         = 15\nwrite(2, \":\", 1:)                        = 1\nwrite(2, \"4\", 14)                        = 1\nwrite(2, \"] \", 2] )                       = 2\nwrite(2, \"3\", 13)                        = 1\nwrite(2, \" = \", 3 = )                      = 3\nwrite(2, \"3\", 13)                        = 1\nwrite(2, \"\\n\", 1\n)                       = 1\nwrite(2, \"[\", 1[)                        = 1\nwrite(2, \"examples/dbg.rs\", 15examples/dbg.rs)         = 15\nwrite(2, \":\", 1:)                        = 1\nwrite(2, \"4\", 14)                        = 1\nwrite(2, \"] \", 2] )                       = 2\nwrite(2, \"4\", 14)                        = 1\nwrite(2, \" = \", 3 = )                      = 3\nwrite(2, \"4\", 14)                        = 1\nwrite(2, \"\\n\", 1\n)                       = 1\n```\n\natomic-dbg is `no_std`, however like `std`, it uses the stderr file descriptor\nambiently, assuming that it's open.\n\n## Logging\n\nWith the \"log\" feature enabled, atomic-dbg defines an `atomic_dbg::log::init`\nwhich installed a minimal logging implementation using the `eprintln` macro.\n\n[counterparts]: https://doc.rust-lang.org/stable/std/macro.dbg.html\n[in]: https://doc.rust-lang.org/stable/std/macro.eprintln.html\n[std]: https://doc.rust-lang.org/stable/std/macro.eprint.html\n[`dbg`]: https://docs.rs/atomic-dbg/latest/atomic-dbg/macro.dbg.html\n[`eprintln`]: https://docs.rs/atomic-dbg/latest/atomic-dbg/macro.eprintln.html\n[`eprint`]: https://docs.rs/atomic-dbg/latest/atomic-dbg/macro.eprint.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunfishcode%2Fatomic-dbg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsunfishcode%2Fatomic-dbg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunfishcode%2Fatomic-dbg/lists"}