Open jawoznia opened 7 months ago
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;
}
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;
}
Once we will support associated types we might consider removing additional support for
ExecC
andQueryC
associated types and allow users to specify their own types as custom using thesv::custom()
attribute.Motivation
Currently our API allows interface to be defined in two ways:
sv::custom
attributeSince 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.