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

docs: io types' getter docs mentions "sink or stream", but it is reader or writer #2681

Open
taiki-e opened this issue Jan 7, 2023 · 0 comments
Labels

Comments

@taiki-e
Copy link
Member

taiki-e commented Jan 7, 2023

https://docs.rs/futures/latest/futures/io/struct.Take.html#method.get_ref

Acquires a reference to the underlying sink or stream that this combinator is pulling from.

These methods are defined by the delegate_access_inner macro and we need to fix that macro.

delegate_access_inner!(inner, R, ());

macro_rules! delegate_access_inner {
($field:ident, $inner:ty, ($($ind:tt)*)) => {
/// Acquires a reference to the underlying sink or stream that this combinator is
/// pulling from.
pub fn get_ref(&self) -> &$inner {
(&self.$field) $($ind get_ref())*
}
/// Acquires a mutable reference to the underlying sink or stream that this
/// combinator is pulling from.
///
/// Note that care must be taken to avoid tampering with the state of the
/// sink or stream which may otherwise confuse this combinator.
pub fn get_mut(&mut self) -> &mut $inner {
(&mut self.$field) $($ind get_mut())*
}
/// Acquires a pinned mutable reference to the underlying sink or stream that this
/// combinator is pulling from.
///
/// Note that care must be taken to avoid tampering with the state of the
/// sink or stream which may otherwise confuse this combinator.
pub fn get_pin_mut(self: core::pin::Pin<&mut Self>) -> core::pin::Pin<&mut $inner> {
self.project().$field $($ind get_pin_mut())*
}
/// Consumes this combinator, returning the underlying sink or stream.
///
/// Note that this may discard intermediate state of this combinator, so
/// care should be taken to avoid losing resources when this is called.
pub fn into_inner(self) -> $inner {
self.$field $($ind into_inner())*
}
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant