Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove useless liftetime paramenter in LoadBalance:: InstanceIter #73

Merged
merged 1 commit into from
Oct 26, 2022

Conversation

ethe
Copy link
Member

@ethe ethe commented Oct 26, 2022

Motivation

Because Loadbalance always get the discovery result like Arc<Vec<Instance>>, it should be 'static and does not need to give it a lifetime paramenter, it is useful to walkaround compiler issue rust-lang/rust#100013.

Solution

Modify service trait like this:

pub trait LoadBalance<D>: Send + Sync + 'static
where
    D: Discover,
{
    type InstanceIter: Iterator<Item = Address> + Send;
    type GetFut<'future>: Future<Output = Result<Self::InstanceIter, LoadBalanceError>>
        + Send
        + 'future
    where
        Self: 'future;
}

@PureWhiteWu PureWhiteWu linked an issue Oct 26, 2022 that may be closed by this pull request
@ethe ethe changed the title remove useless liftetime paramenter in LoadBalance::InstancePicker remove useless liftetime paramenter in LoadBalance:: InstanceIter Oct 26, 2022
@PureWhiteWu PureWhiteWu enabled auto-merge (squash) October 26, 2022 04:11
@PureWhiteWu PureWhiteWu merged commit 528314f into cloudwego:main Oct 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

error: non-defining opaque type use in defining scope
3 participants