Skip to content

Conversation

madsmtm
Copy link
Owner

@madsmtm madsmtm commented Sep 21, 2023

Builds upon #516.

We now use &(impl MyProtocol + Message) instead of &ProtocolObject<dyn MyProtocol> as parameters to functions, this allows users to pass in their objects to these functions much more easily.

I'm not sure it's worth the tradeoff in code size though (since now a lot of methods are generic where they don't really have to be), will have to think about.

Alternative to #686 (that one is still strictly cleaner, but probably also not really possible in current Rust (?)).

@madsmtm madsmtm added enhancement New feature or request A-framework Affects the framework crates and the translator for them labels Sep 21, 2023
@madsmtm madsmtm added this to the Polish icrate milestone Sep 21, 2023
@madsmtm madsmtm force-pushed the protocol-fixes branch 6 times, most recently from 2b57f62 to 1c663ba Compare December 3, 2023 08:11
Base automatically changed from protocol-fixes to master December 3, 2023 08:33
@madsmtm madsmtm force-pushed the minimize-use-of-protocolobject branch from 392f711 to 3449797 Compare November 25, 2024 15:25
Comment on lines -79 to -80
let object = ProtocolObject::from_ref(&*delegate);
app.setDelegate(Some(object));
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I've never used ::from_ref() for these before but always just object = delegate.as_ref() which is a bit more concise and also seemed to figure out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-framework Affects the framework crates and the translator for them enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants