@@ -28,7 +28,6 @@ use futures::{Future, StreamExt, TryFutureExt};
2828use serde:: de:: DeserializeOwned ;
2929use serde:: { Deserialize , Serialize } ;
3030use serde_json:: { self , json} ;
31- use std:: borrow:: Borrow ;
3231use std:: fmt:: Display ;
3332use std:: future:: IntoFuture ;
3433use std:: pin:: Pin ;
@@ -510,7 +509,7 @@ impl Context {
510509 /// let jetstream = async_nats::jetstream::new(client);
511510 ///
512511 /// let stream = jetstream
513- /// .update_stream(& Config {
512+ /// .update_stream(Config {
514513 /// name: "events".to_string(),
515514 /// discard: DiscardPolicy::New,
516515 /// max_messages: 50_000,
@@ -520,11 +519,11 @@ impl Context {
520519 /// # Ok(())
521520 /// # }
522521 /// ```
523- pub async fn update_stream < S > ( & self , config : S ) -> Result < Info , UpdateStreamError >
522+ pub async fn update_stream < S > ( & self , config : S ) -> Result < Stream , UpdateStreamError >
524523 where
525- S : Borrow < Config > ,
524+ S : Into < Config > ,
526525 {
527- let config = config. borrow ( ) ;
526+ let config: Config = config. into ( ) ;
528527
529528 if config. name . is_empty ( ) {
530529 return Err ( CreateStreamError :: new (
@@ -539,9 +538,13 @@ impl Context {
539538 }
540539
541540 let subject = format ! ( "STREAM.UPDATE.{}" , config. name) ;
542- match self . request ( subject, config) . await ? {
541+ match self . request ( subject, & config) . await ? {
543542 Response :: Err { error } => Err ( error. into ( ) ) ,
544- Response :: Ok ( info) => Ok ( info) ,
543+ Response :: Ok ( info) => Ok ( Stream {
544+ context : self . clone ( ) ,
545+ info,
546+ name : config. name ,
547+ } ) ,
545548 }
546549 }
547550
0 commit comments