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

feat: implement PartialEq for SimpleExpr and its related types #620

Merged
merged 11 commits into from
Apr 11, 2023

Conversation

billy1624
Copy link
Member

@billy1624 billy1624 commented Mar 18, 2023

PR Info

New Features

  • Implemented PartialEq for SimpleExpr and on its related types

Breaking Changes

  • Remaned SeaRc into RcOrArc
  • Added a new struct SeaRc which resemble the API of SeaRC as it used to be
let table_as: DynIden = SeaRc::new(Alias::new("char"));
// Or,
let table_as: DynIden = Alias::new("char").into_iden();

// Clone it
let cloned: DynIden = SeaRc::clone(&table_as);

// From a enum Iden
let char_id: DynIden = Character::Id.into_iden();

@tyt2y3
Copy link
Member

tyt2y3 commented Mar 18, 2023

Thank you for the effort.
I agree we have to own the type DynIden in order to make this work.
However, I suspect we may be able to make an upgrade via the type SeaRc.

pub type DynIden = SeaRc<Iden>;

#[drive(Clone, ... many)]
#[repr(transparent)]
pub struct SeaRc<I>(i: RcOrArc<dyn I>);

// we only implement it for Iden
impl<I: Iden> SeaRc<I> {
    pub fn new(i: I) -> DynIden {
        Self(RcOrArc::new(i))
    }
}

That way we don't have to maintain two types! Although it is a breaking change, I hope that the typical user would not need to change a lot of things, if they are already using SeaRc.

@billy1624
Copy link
Member Author

It works! But with a bit more extra efforts :P

Let me think about it and revisit this tmr morning

@billy1624 billy1624 marked this pull request as ready for review March 20, 2023 11:02
Copy link
Member

@ikrivosheev ikrivosheev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@billy1624 thank you! I have one question.

src/types.rs Show resolved Hide resolved
Copy link
Member

@tyt2y3 tyt2y3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Phenomenal!

@tyt2y3 tyt2y3 merged commit a2ab409 into master Apr 11, 2023
@tyt2y3 tyt2y3 deleted the impl-partial-eq-simple-expr branch April 11, 2023 08:01
@github-actions
Copy link

🎉 Released In 0.29.0 🎉

Your participation is what makes us unique; your adoption is what drives us forward.
Thank you all in the Rust community for making SeaQL what it is today. 🦀
You are also invited to shape it's future! Please star our repos, every ⭐ counts!

@github-actions
Copy link

🎉 Released In 0.29.1 🎉

Thank you everyone for the contribution!
This feature is now available in the latest release. Now is a good time to upgrade!
Your participation is what makes us unique; your adoption is what drives us forward.
You can support SeaQL 🌊 by starring our repos, sharing our libraries and becoming a sponsor ⭐.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants