martinzink commented on code in PR #2186:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2186#discussion_r3645880674


##########
minifi_rust/minifi_native/src/c_ffi/c_ffi_streams.rs:
##########
@@ -0,0 +1,143 @@
+// 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
+//
+//   https://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 minifi_native_sys::{
+    minifi_input_stream, minifi_input_stream_read, minifi_output_stream, 
minifi_output_stream_write,
+};
+use std::io::{BufRead, Error, Read};
+
+#[derive(Debug)]
+pub struct CffiInputStream<'a> {
+    ptr: *mut minifi_input_stream,
+    buffer: [u8; 8192],
+    pos: usize,
+    cap: usize,

Review Comment:
   it was needed to implement BufRead 
https://doc.rust-lang.org/std/io/trait.BufRead.html (and we need this because a 
bunch of crates rely on this so it makes the lives of the extension creators 
much easier) (e.g. upcoming pgp extension)
   
   
   > A BufRead is a type of Reader which has an internal buffer, allowing it to 
perform extra ways of reading.
   > 
   > For example, reading line-by-line is inefficient without using a buffer, 
so if you want to read by line, you’ll need BufRead, which includes a 
[read_line](https://doc.rust-lang.org/std/io/trait.BufRead.html#method.read_line)
 method as well as a 
[lines](https://doc.rust-lang.org/std/io/trait.BufRead.html#method.lines) 
iterator.
   > 
   
   And yeah thats the idea 👍 



-- 
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]

Reply via email to