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

Remove ExecC and QueryC #294

Open
jawoznia opened this issue Jan 24, 2024 · 2 comments
Open

Remove ExecC and QueryC #294

jawoznia opened this issue Jan 24, 2024 · 2 comments
Labels
backlog Items planned to be done, but with no milestone yet

Comments

@jawoznia
Copy link
Collaborator

jawoznia commented Jan 24, 2024

Once we will support associated types we might consider removing additional support for ExecC and QueryC associated types and allow users to specify their own types as custom using the sv::custom() attribute.

Motivation

Currently our API allows interface to be defined in two ways:

  • through associated type
  • through sv::custom attribute

Since we already forward the associated types I think it would make sense to simplify the API by allowing the user to use only the sv::custom attribute with either solid type or the associated type.

I see the benefit of using standardized type names for better clarity when implementing the interface which type is responsible for what, but I think that it would be easier for user to look in a single place to determine the custom types.
This also has a benefit of simplifying sylvia code.

#[interface]
#[sv::custom(msg=Exec, query=Query)]
pub trait MyInterface {
    type Error;
    type Exec: CustomMsg;
    type Query: CustomQuery;
}
@jawoznia jawoznia added the idea label Jan 24, 2024
@hashedone
Copy link
Collaborator

I'm good with that, but:

#[interface]
#[sv::custom(msg=Self::Exec, query=Self::Query)]
pub trait MyInterface {
    type Error;
    type Exec: CustomMsg;
    type Query: CustomQuery;
}

@hashedone hashedone added backlog Items planned to be done, but with no milestone yet and removed idea labels Feb 20, 2024
@kulikthebird
Copy link
Contributor

If this becomes a mandatory attribute, let's consider something like this:

#[interface(custom_msg=Self::Exec, custom_query=Self::Query))]
pub trait MyInterface {
    type Error;
    type Exec: CustomMsg;
    type Query: CustomQuery;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Items planned to be done, but with no milestone yet
Projects
None yet
Development

No branches or pull requests

3 participants