File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -525,3 +525,26 @@ impl Write for Cursor<Box<[u8]>> {
525525 Ok ( ( ) )
526526 }
527527}
528+
529+ #[ stable( feature = "cursor_array" , since = "1.60.0" ) ]
530+ impl < const N : usize > Write for Cursor < [ u8 ; N ] > {
531+ #[ inline]
532+ fn write ( & mut self , buf : & [ u8 ] ) -> io:: Result < usize > {
533+ slice_write ( & mut self . pos , & mut self . inner , buf)
534+ }
535+
536+ #[ inline]
537+ fn write_vectored ( & mut self , bufs : & [ IoSlice < ' _ > ] ) -> io:: Result < usize > {
538+ slice_write_vectored ( & mut self . pos , & mut self . inner , bufs)
539+ }
540+
541+ #[ inline]
542+ fn is_write_vectored ( & self ) -> bool {
543+ true
544+ }
545+
546+ #[ inline]
547+ fn flush ( & mut self ) -> io:: Result < ( ) > {
548+ Ok ( ( ) )
549+ }
550+ }
Original file line number Diff line number Diff line change @@ -104,6 +104,18 @@ fn test_box_slice_writer_vectored() {
104104 test_slice_writer_vectored ( & mut writer) ;
105105}
106106
107+ #[ test]
108+ fn test_array_writer ( ) {
109+ let mut writer = Cursor :: new ( [ 0u8 ; 9 ] ) ;
110+ test_slice_writer ( & mut writer) ;
111+ }
112+
113+ #[ test]
114+ fn test_array_writer_vectored ( ) {
115+ let mut writer = Cursor :: new ( [ 0u8 ; 9 ] ) ;
116+ test_slice_writer_vectored ( & mut writer) ;
117+ }
118+
107119#[ test]
108120fn test_buf_writer ( ) {
109121 let mut buf = [ 0 as u8 ; 9 ] ;
You can’t perform that action at this time.
0 commit comments