~/bend-docscommunity

src/lsp/files/disk.bend relies on unsafe/foreign

raw source on the hub · import bolt@1.55.0.0/src/lsp/files/disk.bend as Disk

files/disk: the real file system. A file is read as one text of its size, so no read ends inside a UTF-8 char; anything past that size (a file that grew) is read on, a megabyte at a time. Each byte that is not UTF-8 reads as one char.

3 imports
import Base
import ./service.bend as S
import ../../walk/disk.bend as WalkDisk

Definitions

def whole.end source · line 10 · raw

@file:File -> @acc:List<&2, String> -> IO(Maybe<&2, String>)

the texts read, last first, as one text; the file closed

def whole.more source · line 16 · raw

@done:Bool -> @tt:String -> @file:File -> @acc:List<&2, String> -> @rest:(@_:File -> @_:List<&2, String> -> IO(Maybe<&2, String>)) -> IO(Maybe<&2, String>)

an empty read is the end; anything else is one more text

def whole.got source · line 30 · raw

@rr:Result<&1, &1, Pair(U32, String), String> -> @file:File -> @acc:List<&2, String> -> @rest:(@_:File -> @_:List<&2, String> -> IO(Maybe<&2, String>)) -> IO(Maybe<&2, String>)

a read's text kept, or the end at a failed read

def whole.next source · line 43 · raw

@got:Pair(File, Result<&1, &1, Pair(U32, String), String>) -> @acc:List<&2, String> -> @rest:(@_:File -> @_:List<&2, String> -> IO(Maybe<&2, String>)) -> IO(Maybe<&2, String>)

a read and the file it leaves

def whole.rest source · line 53 · raw

@fuel:Nat -> @file:File -> @acc:List<&2, String> -> IO(Maybe<&2, String>)

what is left of the file, a megabyte a read, until a read is empty or the fuel is spent

def whole.size source · line 63 · raw

@rr:Result<&1, &1, Pair(U32, String), U32> -> U32

a size, or none known

def whole.sized source · line 71 · raw

@got:Pair(File, Result<&1, &1, Pair(U32, String), U32>) -> IO(Maybe<&2, String>)

the file read as one text of its size, then whatever more it holds

def read.opened source · line 77 · raw

@rr:Result<&1, &1, Pair(U32, String), File> -> IO(Maybe<&2, String>)

def read source · line 87 · raw

@path:String -> IO(Maybe<&2, String>)

a file's text, or None when it cannot be opened

def base_path.of source · line 92 · raw

@rr:Result<&1, &1, Pair(U32, String), String> -> IO(String)

def base_path source · line 100 · raw

@_u:Unit -> IO(String)

Base, where bend's installer puts it

def cwd source · line 106 · raw

@_u:Unit -> IO(String)

the working directory, as the lint's walk names it

def entries source · line 110 · raw

@dir:String -> IO(List<&2, String>)

a directory's entries, as the lint's walk lists them

def new source · line 114 · raw

0x401259e5808584b2f596ec853c7a7834/src/lsp/files/service.Files

the real file system