From: Skgland Date: Thu, 11 Mar 2021 00:18:11 +0000 (+0100) Subject: improve comment X-Git-Tag: v0.9.0~130^2~3 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=d437609365095665897eeb4b97e58cc67fe0d2ac;p=scryer-prolog.git improve comment --- 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 });