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

Consider making value::Stream constructor public #24

Closed
KodrAus opened this issue Jan 20, 2019 · 1 comment
Closed

Consider making value::Stream constructor public #24

KodrAus opened this issue Jan 20, 2019 · 1 comment

Comments

@KodrAus
Copy link
Collaborator

KodrAus commented Jan 20, 2019

For proper streaming scenarios like tokio-trace where implementors of its Subscriber trait will want to hold on to a stream across an arbitrary number of calls.

It means callers would then be able to call Value::stream(1, &mut value::Stream::new(stream)). This might also be confusing within Value implementations. It needs some thought.

@KodrAus
Copy link
Collaborator Author

KodrAus commented Feb 25, 2019

Alternatively, we could introduce an value::OwnedStream that wraps up a generic T: stream::Stream and debug stack, and can be borrowed as a value::Stream.

The current value::Stream expects to be borrowed, so it's not useful for scenarios where you need to own the stream across calls, and having an owned variant we can borrow from avoids having to introduce a branch into every streaming call for a Cow-like approach that bungs an owned or borrowed stream into the same structure.

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

No branches or pull requests

1 participant