Commit 8b7ec38

kravantokh <kravantokh@noreply.codeberg.org>
2026-09-01 19:28:13
Add Filview_as_StrSlc.
1 parent d2349b0
Changed files (2)
notlibc.c
@@ -1217,6 +1217,10 @@ Status FileView_from_path( const Str *path, usize claim_amount, usize flags, Fil
 	return FileView_from_file(&file, claim_amount, flags, out);
 }
 
+StrSlc FileView_as_StrSlc( const FileView *fv ) {
+	return (StrSlc){ .len = fv->filesize, .data = (const u8*)fv->start };
+}
+
 Status FileView_extend_file( FileView *fv, usize amount ) {
 	if( amount > fv->claimed - fv->filesize ) {
 		return S_FAILURE | ERR_OUT_OF_BOUND;
notlibc.h
@@ -1482,11 +1482,14 @@ Status FileView_from_file( File *file, usize claim_amount, usize flags, FileView
  * control over the opening flags use FileView_from_file */
 Status FileView_from_path( const Str *path, usize claim_amount, usize flags, FileView *out );
 
+StrSlc FileView_as_StrSlc( const FileView *fv );
+
 /* Extend the file's end by amount */
 Status FileView_extend_file( FileView *fv, usize amount );
 
 Status FileView_destroy( FileView *fv );
 
+
 /*=========================== Core functions =================================*/
 
 void terminate(u32 code); /* aka exit */