-
Notifications
You must be signed in to change notification settings - Fork 2
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
add more lifetime/generics support for o2o #17
Conversation
@Artem-Romanenia please take a look at this |
Hi, thanks a lot for a PR! I will look into it as soon as I have a chance, maybe today, definitely before weekend. |
Hey it seems that you dont run |
Hi, thanks again for a contribution! I have a couple of notes though. Generally, if there are use o2o::o2o;
pub struct Entity {
pub some_a: String,
pub some_b: String,
}
#[derive(o2o)]
#[from_ref(Entity)]
pub struct EntityDto<'a, 'b> {
#[from(~.as_str())]
pub some_a: &'a str,
#[from(~.as_str())]
pub some_b: &'b str,
} But I would also like to support something like this: use o2o::o2o;
#[derive(o2o)]
#[ref_into(EntityDto<'a, 'b>)]
pub struct Entity {
#[into(~.as_str())]
pub some_a: String,
#[into(~.as_str())]
pub some_b: String,
}
pub struct EntityDto<'a, 'b> {
pub some_a: &'a str,
pub some_b: &'b str,
} Other than that, I would only ask you to add some tests in o2o-tests package (my tests are mess, so you just can loosely imitate what's going on there 😄). And also, when editing readme, I use "Markdown All in One" extension in VS Code, which syncronizes table of content. You can try using that or something similar, or I will just make some final touches to readme myself in the end, if you don't want to bother with this 😄 |
Hi, could you merge this PR first and run |
So, the problem here is that default formatting sometimes goes against my personal preferences, however unconventional they are 😄 (mainly, I often value vertical compactness over horizontal, since mostly I do rust on 34'' widescreen and I have no problems with long lines). But here's an idea. I've created |
There are a lot of thing you can config with
|
Ok, I guess no harm if I do it as you've originally suggested. But I'll do the configuration later, as I currently don't have access to my regular setup. |
I've just added a commit with formatting to main, you should be good to go (hopefully 😄) |
This is my attempt for #16.