Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Make clear that this crate helps specifically with type conversions #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
[![badge](https://docs.rs/momo/badge.svg)](https://docs.rs/momo)

This is a `proc_macro` crate to help keeping the code footprint of
generic methods in check. Often, generics are used in libraries to
improve ergonomics. However, this has a cost in compile time and
binary size. Optimally, one creates a small shell function that
does the generic conversions and then calls an inner function, but
that makes the code less readable.
generic methods in check. Often, generics are only needed for
ergonomics: Library code might want to present an easy-to-use generic
interface that will automate some type conversions. However, this has
a cost in compile time and binary size. Optimally, one creates a
small shell function that does the generic conversions and then calls
an inner function, butthat makes the code less readable.

Add a `#[momo]` annotation from this crate to split your function
into an outer conversion and a private inner function. In return,
Expand All @@ -18,6 +19,8 @@ Conversions currently supported are `Into` (`.into()`), `AsRef`
(`.as_ref()`), and `AsMut` (`.as_mut()`). See `enum Conversions`
in code.

Check out [my blog post](https://llogiq.github.io/2019/05/18/momo.html)
for a bit more information on why this crate exists.

## Notes on watt

Expand Down