From d437609365095665897eeb4b97e58cc67fe0d2ac Mon Sep 17 00:00:00 2001 From: Skgland Date: Thu, 11 Mar 2021 01:18:11 +0100 Subject: [PATCH] improve comment --- src/machine/streams.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/machine/streams.rs b/src/machine/streams.rs index e1401b0e..97c3b494 100644 --- a/src/machine/streams.rs +++ b/src/machine/streams.rs @@ -365,7 +365,17 @@ impl Stream { } pub fn bytes(&self) -> Option>> { - // if Ref had an and_then function this could be simplified + /* + // Replacement of workaround for when we have stable https://github.com/rust-lang/rust/issues/81061 + std::cell::Ref::filter_map( + self.stream_inst.0.borrow(), + |inner_stream| match inner_stream.stream_inst { + StreamInstance::Bytes(cursor) => Some(cursor.get_ref()), + _ => None, + }, + ) + .ok() + */ let val = std::cell::Ref::map(self.stream_inst.0.borrow(), |inner_stream| { &inner_stream.stream_inst }); -- 2.54.0