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

feat: from url and from iterator for streameruri #28

Merged
merged 5 commits into from
Jun 2, 2024

Conversation

carlocorradini
Copy link
Contributor

PR Info

Added From<Url> and FromIterator<Url> for StreamerUri.

New Features

  • impl From<Url> for StreamerUri
    let url: Url = "proto://sea-ql.org:1234".parse().unwrap();
    let uri: StreamerUri = url.into();
  • impl FromIterator<Url> for StreamerUri
    let urls: [Url; 3] = ["proto://sea-ql.org:1".parse().unwrap() ,"proto://sea-ql.org:2".parse().unwrap(), "proto://sea-ql.org:3".parse().unwrap()];
    let uri: StreamerUri = StreamerUri::from_iter(urls.into_iter());

@carlocorradini
Copy link
Contributor Author

Unfortunately the following does not compile due to Send (it is required?)

fn connect(
        streamer: impl Into<StreamerUri>,
        options: Self::ConnectOptions,
) -> impl Future<Output = StreamResult<Self, Self::Error>> + Send;

@tyt2y3
Copy link
Member

tyt2y3 commented May 23, 2024

it is possible, if we add Send as a trait bound?

fn connect<S>(
        streamer: S,
        options: Self::ConnectOptions,
) -> impl Future<Output = StreamResult<Self, Self::Error>> + Send
where S: Into<StreamerUri> + Send, {}

@carlocorradini
Copy link
Contributor Author

Done 🥳

@tyt2y3
Copy link
Member

tyt2y3 commented May 29, 2024

Sad, there was a bunch of errors, where type inference fails.

@carlocorradini
Copy link
Contributor Author

I'll fix it ASAP.
Sadness... I've run cargo build --all --all-features (same for test) and it worked.

@tyt2y3
Copy link
Member

tyt2y3 commented May 30, 2024

It can be reproduced by cargo test --no-run. May be we change to parse::< StreamerUri >() in all cases

@carlocorradini
Copy link
Contributor Author

Done 🥳

Copy link
Member

@tyt2y3 tyt2y3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

@tyt2y3 tyt2y3 merged commit b824c71 into SeaQL:main Jun 2, 2024
9 checks passed
tyt2y3 pushed a commit that referenced this pull request Jul 6, 2024
tyt2y3 added a commit that referenced this pull request Jul 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

impl From<Url> for StreamerUri
2 participants