Can the BackgroundService
support a &mut self
reference?
#465
Labels
ergonomics
Ease of use, developer friendliness
BackgroundService
support a &mut self
reference?
#465
What is the problem your feature solves, or the need it fulfills?
The current signature of the start method in the
BackgroundService
trait is as follows.:pingora/pingora-core/src/services/background.rs
Lines 31 to 37 in bdb13a7
The
self
parameter is immutable. Currently, I have a function that needs to run in the background and requires&mut self
. The scenario is quite simple: it involves consuming from a channel, but becauseself
is immutable, it cannot performrecv
. Here’s an example of the code:The following code shows that when the upper method calls
start
,self
is&mut self
. However, when it comes to thestart
method,self
becomes&self
, and these two signatures are not quite consistent. Is there a specific reason for this? I hope you can help clarify this for me. Thank you very much.pingora/pingora-core/src/services/background.rs
Lines 66 to 76 in bdb13a7
Describe the solution you'd like
Is it possible to change the method signature from
&self
to&mut self
?The text was updated successfully, but these errors were encountered: