You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: logical.rs
    path of file: ./repos/linkerd2-proxy/linkerd/app/outbound/src/opaq
    
    the code of the file until where you have to start completion: use super::concrete;
use crate::Outbound;
use linkerd_app_core::{
    io,
    profiles::{self, Profile},
    proxy::{api_resolve::Metadata, tcp::balance},
    svc,
    transport::addrs::*,
    Error, Infallible, NameAddr,
};
use linkerd_distribute as distribute;
use std::{fmt::Debug, hash::Hash, time};
use tokio::sync::watch;

#[cfg(test)]
mod tests;

#[derive(Clone, Debug)]
pub enum Logical {
    Route(NameAddr, profiles::Receiver),
    Forward(Remote<ServerAddr>, Metadata),
}

#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct Concrete<T> {
    target: concrete::Dispatch,
    parent: T,
}

#[derive(Debug, thiserror::Error)]
#[error("no route")]
pub struct NoRoute;

#[derive(Debug, thiserror::Error)]
#[error("logical service {addr}: {source}")]
pub struct LogicalError {
    addr: NameAddr,
    #[source]
    source: Error,
}

#[derive(Clone, Debug, PartialEq, Eq)]
struct Params<T: Eq + Hash + Clone + Debug> {
    parent: T,
    route: RouteParams<T>,
    backends: distribute::Backends<Concrete<T>>,
}

#[derive(Clone, Debug, PartialEq, Eq, Hash)]
struct RouteParams<T> {
    parent: T,
    distribution: Distribution<T>,
}

type NewBackendCache<T, N, S> = distribute::NewBa
    
    fn from((profile, routable): (Profile, Routable<T>)) -> Self {
        const EWMA: balance::EwmaConfig = balance::EwmaConfig {
            default_rtt: time::Duration::from_millis(30),
            decay: time::Duration::from_secs(10),
        };

        // Create concrete targets for all of the profile's routes.
        let (backends, distribution) = if profile.targets.is_empty() {
            let concrete = Concrete {
                target: concrete::Dispatch::Balance(routable.addr.clone(), routable.addr, EWMA),
                parent: routable.parent.clone(),
            };
            let backends = std::iter::once(concrete.clone()).collect();
            let distribution = Distribution::first_available(std::iter::once(concrete));
            (backends, distribution)
        } else {
            let backends = profile
                .targets
                .iter()
                .map(|t| Concrete {
                    target: concrete::Dispatch::Balance(
                        routable.addr.clone(),
                        t.addr.clone(),
                        EWMA,
                    ),
                    parent: routable.parent.clone(),
                })
                .collect();
            let distribution = Distribution::random_available(profile.targets.iter().cloned().map(
                |profiles::Target { addr, weight }| {
                    let concrete = Concrete {
                        target: concrete::Dispatch::Balance(routable.addr.clone(), addr, EWMA),
                        parent: routable.parent.clone(),
                    };
                    (concrete, weight)
                },
            ))
            .expect("distribution must be valid");

            (backends, distribution)
        };

        let route = RouteParams {
            parent: routable.parent.clone(),
            distribution,
        };

        Self {
            parent: routable.parent,
            backends,
            route,
        }
    }