pub fn spawn_with_init<T, U>(mut self, target: T, init: U) -> watch::Receiver<U>
    where
        T: Clone + Send + Sync + 'static,
        U: Send + Sync + 'static,
        S: Service<T, Response = InnerRsp<U>, Error = tonic::Status>,
        S::Future: Send,
    {
        let (tx, rx) = watch::channel(init);

        // Spawn a background task to watch the inner service.
        tokio::spawn(
            async move {
                let (up, rsp) = self.init(&target, None).await?;
                if tx.send(up).is_ok() {
                    self.publish_updates(target, tx, rsp.into_inner()).await;
                }
                Ok::<_, tonic::Status>(())
            }
            .in_current_span(),
        );

        rx
    }
/// Returns a watch using the provided initial value.
///
/// The watch is spawned on a background task that completes when the watch service errors in an
/// unrecoverable way or all receivers are dropped.
Returns a watch using the provided initial value.
The watch is spawned on a background task that completes when the watch service errors in an
unrecoverable way or all receivers are dropped.
Returns a watch using the provided initial value . The watch is spawned on a background task that completes when the watch service errors in an unrecoverable way or all receivers are dropped .
pub fn spawn_with_init<T, U>(mut self, target: T, init: U) -> watch::Receiver<U>
    where
        T: Clone + Send + Sync + 'static,
        U: Send + Sync + 'static,
        S: Service<T, Response = InnerRsp<U>, Error = tonic::Status>,
        S::Future: Send,
    {
        let (tx, rx) = watch::channel(init);
        // Spawn a background task to watch the inner service.
        tokio::spawn(
            async move {
                let (up, rsp) = self.init(&target, None).await?;
                if tx.send(up).is_ok() {
                    self.publish_updates(target, tx, rsp.into_inner()).await;
                }
                Ok::<_, tonic::Status>(())
            }
            .in_current_span(),
        );
        rx
    }
pub fn spawn_with_init < T , U > ( mut self , target : T , init : U ) -> watch :: Receiver < U > where T : Clone + Send + Sync + ' static , U : Send + Sync + ' static , S : Service < T , Response = InnerRsp < U > , Error = tonic :: Status > , S :: Future : Send , { let ( tx , rx ) = watch :: channel ( init ) ; // Spawn a background task to watch the inner service. tokio :: spawn ( async move { let ( up , rsp ) = self . init ( & target , None ) . await ? ; if tx . send ( up ) . is_ok ( ) { self . publish_updates ( target , tx , rsp . into_inner ( ) ) . await ; } Ok :: < _ , tonic :: Status > ( ( ) ) } . in_current_span ( ) , ) ; rx }
Returns a watch using the provided initial value.
Returns a watch using the provided initial value .
mut self
target
T
init
U
mut self
target
T
init
U