-
Notifications
You must be signed in to change notification settings - Fork 21
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: Expose AutoStream getters for the wrapped RawStream #222
base: main
Are you sure you want to change the base?
Conversation
Could you add to the PR description the use case for why this would be needed? |
Pull Request Test Coverage Report for Build 11501103511Details
💛 - Coveralls |
ebb2421
to
900d738
Compare
Done. |
Please expand on why note: generally I require Issues first where this is all figured out. It isn't always ideal to have these conversations in PRs. |
`AutoStream` can be consumed to get the wrapped `S: RawStream`, but there is currently no way to get a reference to it.
900d738
to
a5e8e5a
Compare
Figured it would be straight-forward enough that it wouldn't require an issue. I have a potentially Currently I have to either store a raw pointer to the Correct me if I'm wrong, but given that |
I need to weigh out your use case and the complexity foisted on you against helping to prevent bugs for others. The more generally applicable it seems, the more it weighs in favor of making the change.
Maybe asked a different way, what problem are you trying to solve? Why do you need a single
Depending on your use case, you may be able to use |
Hmm, another interesting design idea that I don't think of enough is the use of extension traits to opt-in to potentially dangerious (but not |
I am using similar setup to the rustc diagnostics system:
My goal is to obtain the
That would be fine by me if it is deemed necessary for this API. I would imagine that it wouldn't be required for immutable references. |
Thanks for explanation. Are you always using |
AutoStream
can be consumed to get the wrappedS: RawStream
, but there is currently no way to get a reference to it.My use case for this is being able to get the
&mut dyn Write
while storingAutoStream<Box<dyn Write>>
, and to either write directly to it or downcast it toVec<u8>
to get the access to the written bytes.