-
Notifications
You must be signed in to change notification settings - Fork 69
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
Make it ready for v0.9.0 #82
Comments
These are both good changes to make. One other I'd like to squeeze into v0.9.0 is a fix for #8, changing the license from MIT to dual MIT/Apache-2. The changes you've made since v0.8.0 are substantial though, so I'd be ok doing a release without that change if you'd prefer. |
Yeah sure! I'm not really at home with licensing though, so if you can do that, then I can work on the other two issues? |
Me neither. :) I can take care of it, sure. |
Quick question about Edit: pub type Ordinal = u32;
pub type OrdinalSet = BTreeSet<Ordinal>;
pub type OrdinalIter<'a> = btree_set::Iter<'a, Ordinal>;
pub type OrdinalRangeIter<'a> = btree_set::Range<'a, Ordinal>; Which could've been so clean
Edit on edit: |
Sounds sensible to me.
It's impossible to rule it out without testing/measurement, but that would surprise me. An
The copying that's happening is basically a dereference of the I'm happy to be proven wrong if you'd like to dig into it! |
Welp, I guess your right. The execution time changed from 186 to 184, which is insignificant, and it was a pain to code with. pub type OrdinalIter<'a> = Cloned<btree_set::Iter<'a, Ordinal>>;
pub type OrdinalRangeIter<'a> = Cloned<btree_set::Range<'a, Ordinal>>; Then in the time_unit mod: impl<T> TimeUnitSpec for T
where
T: TimeUnitField,
{
//...
fn iter(&self) -> OrdinalIter {
TimeUnitField::ordinals(self).iter().cloned()
}
//...
} That way it looks way cleaner, and as a bonus you get all |
Based on a hazy recollection of implementing this years ago, I believe my main concerns with using a type alias were that:
Combined with the fact that the compiler will reduce the layout of a struct with a single field into that field's layout, it seemed reasonable to just make my own wrapper type. I wish Rust offered a version of
That's compelling! Unfortunately, I think the public API exposure is enough of a problem that it's worth exposing those individually/manually. Which traits have you found yourself missing? |
I honestly didn't know that. But I get that that is a concern.
I doubt that those kind of breaking changes to the standard library would happen without an opt-in. Maybe if you change the rust edition. Otherwise a whole boatload of rust libraries would have the same problem.
So I thought I'd live by that "credo" as much as possible
I'm not missing anything in particular. I was just trying to make everything as neat as possible, so that you can reason about the project a bit more easily. I just thought that the implementation of a If I'm going to refactor it without a typealias, then I just need to either make the field pub, or create a pub constructor. The module is private though, so it will only be exposed to the crate. Edit: Edit on edit: let foo: i32 = schedule.years().iter(); Still gives me
Even though I made the typealias public. So I get your concern. |
On an unrelated note, I have two nits.
Sorry if coming of as too direct or too critical about a project that isn't mine, I'm just trying to help. |
It's likely to be a day or two before I have a chance to go through the changes you're describing.
Not at all, I appreciate it. It's great to have a second opinion on these things, especially if the library ever hopes to release a |
I think I've missed a beat: what's the use case for users creating their own ordinal iterators?
I'm not aware of a trait called Lines 42 to 51 in 2bbb4f2
(Sorry if there's actually an
Huh! While the type itself is public: Lines 342 to 349 in d0049fc
(which allows it to be returned by public Lines 50 to 51 in d0049fc
Good eye! |
Oh no, I meant exactly the opposite! If I refactor it out to the ordinal mod, it needs a crate public function so it can be used in the time_unit mod. But it should stay private for the user.
Oops, it seems I've made a mistake. I was lookming at the Range and Iter structs in BTreeSet. As far as I can see, range isn't even an existing trait. But it still might be an idea to follow convention and call it OrdinalRange.
Yes, I think that's because the module is private. I think as the code after the rfactor stands right now, everything in that module can be public. (I would still do that using re-exports though, otherwise you'd need to type |
Sorry, I let the ball drop on this thread. 😞 I'll try to revisit it later this week. For the moment: I've released v0.9.0 to make the fix from #84 available. I'll do another release once this change set lands. You dominated the release notes for this one, thanks again for all your help! |
Nothing to worry about. My study picked up the pace again, so I'm focusing on other stuff currently. We'll get back to this later 🙂 |
Having said that. I was bored, and thought I would implement ordinal.rs back to the struct/impl implementation. I left the type aliases commented though, so you can make a comparison, tell me which direction we should take, and what should be deleted |
Because I fixed two of the metaissues in #67 and I would like to use them easily in my own personal project. I was wondering what could be done to make this project ready for v0.9.0
I was thinking a couple of things:
.map(f).unwrap_or_else(g)
into.map_or_else(g,f)
, or with ranges:(min..max + 1)
into(min..=max)
FromString for Schedule
to the schedule.rs file.If there are any other issues that need to be addressed I would love to see it.
Edit:
The text was updated successfully, but these errors were encountered: