pepijnve commented on code in PR #23530: URL: https://github.com/apache/datafusion/pull/23530#discussion_r3570923302
########## datafusion/execution/src/async_stream.rs: ########## @@ -0,0 +1,621 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use futures::Stream; +use futures::future::FusedFuture; +use futures::stream::FusedStream; +use pin_project_lite::pin_project; +use std::ops::DerefMut; +use std::pin::Pin; +use std::sync::{Arc, Mutex}; +use std::task::{Context, Poll}; + +/// A handle for emitting values from an [`async_stream`] generator. +/// +/// The generator closure receives an `Emitter<T>` as its argument. +pub struct Emitter<T> { + slot: Arc<Mutex<Option<T>>>, Review Comment: I'm not sure at what level of detail to explain this or if it's actually strictly required. The emitter needs to be `Send` for now to be able to do the async move, but I don't think we really need `Sync` do we? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
