-
Notifications
You must be signed in to change notification settings - Fork 7
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 constraints from default_main
where possible.
#96
Conversation
If we derive `Clone` manually for `ServerState`, we can avoid the unnecessary constraint on connectors implementing `Clone`.
These are so basic for passing configuration and state around across async boundaries that we should just require them in the trait itself.
C::RawConfiguration: Serialize + DeserializeOwned + JsonSchema + Sync + Send, | ||
C::Configuration: Serialize + DeserializeOwned + Sync + Send + Clone, | ||
C::State: Sync + Send + Clone, | ||
C::RawConfiguration: Serialize + DeserializeOwned + JsonSchema, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Taking the argument of this PR a bit further, is there any sense to any impl Connector for C
that doesn't satisfy the constraints of default_main
?
A connector that doesn't might as well not use ndc-sdk at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, you can make your own main
, in theory. I was wondering this but didn't want to push it too far.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, maybe. I'm just wondering what if anything anyone who makes their own main
function actually gets from using the sdk.
At any rate this is still a fine improvement.
I have made a few changes here.
Sync + Send
to the connector type constraints, because they're so basic that I can't imagine a connector working without them.Clone
onServerState
.