镜像自: https://github.com/DragonOS-Community/thingbuf.git

Eliza Weisman 6ebfe7b8fd feat: add `Deref` and `DerefMut` impls to `Ref` types (#13) 3 жил өмнө
.github 9e413bb759 chore(ci): no tests on PRs that don't touch code 3 жил өмнө
bench 5e26864245 chore: no benchmark-only dev-deps in tests (#11) 3 жил өмнө
bin 974f51e02f chore(test): fix loom script not forwarding args 3 жил өмнө
src 6ebfe7b8fd feat: add `Deref` and `DerefMut` impls to `Ref` types (#13) 3 жил өмнө
tests d590f6d937 test(mpsc): tests for draining after tx closes (#12) 3 жил өмнө
.envrc 84b9ce7057 initial commit 3 жил өмнө
.gitignore 84b9ce7057 initial commit 3 жил өмнө
Cargo.toml 6ebfe7b8fd feat: add `Deref` and `DerefMut` impls to `Ref` types (#13) 3 жил өмнө
README.md 6ebfe7b8fd feat: add `Deref` and `DerefMut` impls to `Ref` types (#13) 3 жил өмнө
default.nix 84b9ce7057 initial commit 3 жил өмнө
shell.nix 84b9ce7057 initial commit 3 жил өмнө

README.md

FAQs

  • Q: Why did you make this?

A: For tracing, I wanted to be able to send formatted log lines to a dedicated worker thread that writes them to a file. Right now, we do this using crossbeam-channel. However, this has the sad disadvantage that we have to allocate Strings, send them through the channel to the writer, and immediately drop them. It would be nice to do this while reusing those allocations. Thus...StringBuf.

  • Q: Is it lock-free?

A: Extremely.

  • Q: Is it wait-free?

A: As long as you don't use the APIs that wait :)

  • Q: Why is there only a bounded variant?

A: Because unbounded queues are of the Devil.

  • Q: Isn't this just a giant memory leak?

A: If you use it wrong, yes.

  • Q: Why is it called that?

A: Originally, I imagined it as a kind of ring buffer, so (as a pun on "ringbuf"), I called it "stringbuf". Then, I realized you could do this with more than just strings. In fact, it can be generalized to arbitrary...things. So, "thingbuf".