Skip to content

Calling multiple mutable functions (e.g. signals) on Pin<&mut T> #1015

Pinned Answered by ahayzen-kdab
SanderVocke asked this question in Q&A
Discussion options

You must be logged in to vote

Yes you would need the implementation to have marked self as mutable

pub fn some_invokable_implementation(mut self : Pin<&mut Self>) {
    self.as_mut().emitSignal1();
    self.emitSignal2();
}

You can see an example of this here

pub fn fetch_title(mut self: Pin<&mut Self>) {
where we have fetch_title with a mut then as_mut() is used within the function
self.as_mut().set_title(QString::from("Loading..."));

Note how the CXX bridge part does not need this mut

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@SanderVocke
Comment options

@ahayzen-kdab
Comment options

Answer selected by SanderVocke
@SanderVocke
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants