@@ -120,81 +120,81 @@ impl<S> Lighthouse<S>
120120 }
121121
122122 /// Replaces the user's lighthouse model with the given frame.
123- pub async fn put_model ( & mut self , frame : Frame ) -> Result < ServerMessage < ( ) > > {
123+ pub async fn put_model ( & self , frame : Frame ) -> Result < ServerMessage < ( ) > > {
124124 let username = self . authentication . username . clone ( ) ;
125125 self . put ( & [ "user" , username. as_str ( ) , "model" ] , Model :: Frame ( frame) ) . await
126126 }
127127
128128 /// Requests a stream of events (including key/controller events) for the user's lighthouse model.
129- pub async fn stream_model ( & mut self ) -> Result < impl Stream < Item = Result < ServerMessage < Model > > > > {
129+ pub async fn stream_model ( & self ) -> Result < impl Stream < Item = Result < ServerMessage < Model > > > > {
130130 let username = self . authentication . username . clone ( ) ;
131131 self . stream ( & [ "user" , username. as_str ( ) , "model" ] , ( ) ) . await
132132 }
133133
134134 /// Fetches lamp server metrics.
135- pub async fn get_laser_metrics ( & mut self ) -> Result < ServerMessage < LaserMetrics > > {
135+ pub async fn get_laser_metrics ( & self ) -> Result < ServerMessage < LaserMetrics > > {
136136 self . get ( & [ "metrics" , "laser" ] ) . await
137137 }
138138
139139 /// Combines PUT and CREATE. Requires CREATE and WRITE permission.
140- pub async fn post < P > ( & mut self , path : & [ & str ] , payload : P ) -> Result < ServerMessage < ( ) > >
140+ pub async fn post < P > ( & self , path : & [ & str ] , payload : P ) -> Result < ServerMessage < ( ) > >
141141 where
142142 P : Serialize {
143143 self . perform ( & Verb :: Post , path, payload) . await
144144 }
145145
146146 /// Updates the resource at the given path with the given payload. Requires WRITE permission.
147- pub async fn put < P > ( & mut self , path : & [ & str ] , payload : P ) -> Result < ServerMessage < ( ) > >
147+ pub async fn put < P > ( & self , path : & [ & str ] , payload : P ) -> Result < ServerMessage < ( ) > >
148148 where
149149 P : Serialize {
150150 self . perform ( & Verb :: Put , path, payload) . await
151151 }
152152
153153 /// Creates a resource at the given path. Requires CREATE permission.
154- pub async fn create ( & mut self , path : & [ & str ] ) -> Result < ServerMessage < ( ) > > {
154+ pub async fn create ( & self , path : & [ & str ] ) -> Result < ServerMessage < ( ) > > {
155155 self . perform ( & Verb :: Create , path, ( ) ) . await
156156 }
157157
158158 /// Deletes a resource at the given path. Requires DELETE permission.
159- pub async fn delete ( & mut self , path : & [ & str ] ) -> Result < ServerMessage < ( ) > > {
159+ pub async fn delete ( & self , path : & [ & str ] ) -> Result < ServerMessage < ( ) > > {
160160 self . perform ( & Verb :: Delete , path, ( ) ) . await
161161 }
162162
163163 /// Creates a directory at the given path. Requires CREATE permission.
164- pub async fn mkdir ( & mut self , path : & [ & str ] ) -> Result < ServerMessage < ( ) > > {
164+ pub async fn mkdir ( & self , path : & [ & str ] ) -> Result < ServerMessage < ( ) > > {
165165 self . perform ( & Verb :: Mkdir , path, ( ) ) . await
166166 }
167167
168168 /// Lists the directory tree at the given path. Requires READ permission.
169- pub async fn list ( & mut self , path : & [ & str ] ) -> Result < ServerMessage < DirectoryTree > > {
169+ pub async fn list ( & self , path : & [ & str ] ) -> Result < ServerMessage < DirectoryTree > > {
170170 self . perform ( & Verb :: List , path, ( ) ) . await
171171 }
172172
173173 /// Gets the resource at the given path. Requires READ permission.
174- pub async fn get < R > ( & mut self , path : & [ & str ] ) -> Result < ServerMessage < R > >
174+ pub async fn get < R > ( & self , path : & [ & str ] ) -> Result < ServerMessage < R > >
175175 where
176176 R : for < ' de > Deserialize < ' de > {
177177 self . perform ( & Verb :: Get , path, ( ) ) . await
178178 }
179179
180180 /// Links the given source to the given destination path.
181- pub async fn link ( & mut self , src_path : & [ & str ] , dest_path : & [ & str ] ) -> Result < ServerMessage < ( ) > > {
181+ pub async fn link ( & self , src_path : & [ & str ] , dest_path : & [ & str ] ) -> Result < ServerMessage < ( ) > > {
182182 self . perform ( & Verb :: Link , dest_path, src_path) . await
183183 }
184184
185185 /// Unlinks the given source from the given destination path.
186- pub async fn unlink ( & mut self , src_path : & [ & str ] , dest_path : & [ & str ] ) -> Result < ServerMessage < ( ) > > {
186+ pub async fn unlink ( & self , src_path : & [ & str ] , dest_path : & [ & str ] ) -> Result < ServerMessage < ( ) > > {
187187 self . perform ( & Verb :: Unlink , dest_path, src_path) . await
188188 }
189189
190190 /// Stops the given stream.
191- pub async fn stop ( & mut self , path : & [ & str ] ) -> Result < ServerMessage < ( ) > > {
191+ pub async fn stop ( & self , path : & [ & str ] ) -> Result < ServerMessage < ( ) > > {
192192 self . perform ( & Verb :: Stop , path, ( ) ) . await
193193 }
194194
195195 /// Performs a single request to the given path with the given payload.
196196 #[ tracing:: instrument( skip( self , payload) ) ]
197- pub async fn perform < P , R > ( & mut self , verb : & Verb , path : & [ & str ] , payload : P ) -> Result < ServerMessage < R > >
197+ pub async fn perform < P , R > ( & self , verb : & Verb , path : & [ & str ] , payload : P ) -> Result < ServerMessage < R > >
198198 where
199199 P : Serialize ,
200200 R : for < ' de > Deserialize < ' de > {
@@ -206,7 +206,7 @@ impl<S> Lighthouse<S>
206206
207207 /// Performs a STREAM request to the given path with the given payload.
208208 #[ tracing:: instrument( skip( self , payload) ) ]
209- pub async fn stream < P , R > ( & mut self , path : & [ & str ] , payload : P ) -> Result < impl Stream < Item = Result < ServerMessage < R > > > >
209+ pub async fn stream < P , R > ( & self , path : & [ & str ] , payload : P ) -> Result < impl Stream < Item = Result < ServerMessage < R > > > >
210210 where
211211 P : Serialize ,
212212 R : for < ' de > Deserialize < ' de > {
@@ -217,7 +217,7 @@ impl<S> Lighthouse<S>
217217 }
218218
219219 /// Sends a request to the given path with the given payload.
220- async fn send_request < P > ( & mut self , verb : & Verb , path : & [ & str ] , payload : P ) -> Result < i32 >
220+ async fn send_request < P > ( & self , verb : & Verb , path : & [ & str ] , payload : P ) -> Result < i32 >
221221 where
222222 P : Serialize {
223223 let path = path. into_iter ( ) . map ( |s| s. to_string ( ) ) . collect ( ) ;
@@ -235,7 +235,7 @@ impl<S> Lighthouse<S>
235235 }
236236
237237 /// Sends a generic message to the lighthouse.
238- async fn send_message < P > ( & mut self , message : & ClientMessage < P > ) -> Result < ( ) >
238+ async fn send_message < P > ( & self , message : & ClientMessage < P > ) -> Result < ( ) >
239239 where
240240 P : Serialize {
241241 self . send_raw ( rmp_serde:: to_vec_named ( message) ?) . await
@@ -291,7 +291,7 @@ impl<S> Lighthouse<S>
291291 }
292292
293293 /// Sends raw bytes to the lighthouse via the WebSocket connection.
294- async fn send_raw ( & mut self , bytes : impl Into < Vec < u8 > > + Debug ) -> Result < ( ) > {
294+ async fn send_raw ( & self , bytes : impl Into < Vec < u8 > > + Debug ) -> Result < ( ) > {
295295 Ok ( self . ws_sink . lock ( ) . await . send ( Message :: Binary ( bytes. into ( ) ) ) . await ?)
296296 }
297297
0 commit comments