pub async fn connect<C>(connector: C, endpoint: Endpoint) -> Result<Self, super::Error>
    where
        C: Service<Uri> + Send + 'static,
        C::Error: Into<crate::BoxError> + Send,
        C::Future: Unpin + Send,
        C::Response: rt::Read + rt::Write + Unpin + Send + 'static,
    {
        let buffer_size = endpoint.buffer_size.unwrap_or(DEFAULT_BUFFER_SIZE);
        let executor = endpoint.executor.clone();

        let svc = Connection::connect(connector, endpoint)
            .await
            .map_err(super::Error::from_source)?;
        let (svc, worker) = Buffer::pair(svc, buffer_size);
        executor.execute(worker);

        Ok(Channel { svc })
    }
Connect to the provided [`Endpoint`] using the provided connector, and return a new [`Channel`].

This is a lower level API, prefer to use [`Endpoint::connect`] if you are not using a custom connector.
tonic/src/transport/channel/mod.rs