Idris2Doc : Data.Buffer.Core

Data.Buffer.Core

(source)

Reexports

importpublic Data.Fin
importpublic Data.Nat

Definitions

prim__getByte : Buffer->Integer->Bits8
prim__getByteOffset : Buffer->Integer->Integer->Bits8
  This is an optimized version of `getByte` that allows us to read
at an offset. On Chez, we can use the faster fixnum addition here,
which can lead to a performance boost.
prim__setByte : Buffer->Integer->Bits8->PrimIO ()
prim__newBuf : Integer->PrimIOBuffer
prim__getString : Buffer->Integer->Integer->String
prim__fromString : String->Buffer
prim__copy : Buffer->Integer->Integer->Buffer->Integer->PrimIO ()
recordIBuffer : Nat->Type
  An immutable byte array of size `n`.

Totality: total
Visibility: export
Constructor: 
IB : Buffer->IBuffern

Projection: 
.buf : IBuffern->Buffer

Hints:
Eq (IBuffern)
Ord (IBuffern)
Show (IBuffern)
at : IBuffern->Finn->Bits8
  Safely access a value in an byte array at the given position.

Totality: total
Visibility: export
atOffset : IBuffern->Finm-> (off : Nat) -> {auto0_ : LTE (off+m) n} ->Bits8
  Safely access a value in an immutable byte array at the given position
and offset.

Totality: total
Visibility: export
take : (0m : Nat) ->IBuffern-> {auto0_ : LTEmn} ->IBufferm
  We can wrap a prefix of an immutable byte array in O(1) simply by giving it
a new size index.

Note: If you only need a small portion of a potentially large
byte array the rest of which you no longer need, consider to
releasing the large byte array from memory by invoking `force`.

Totality: total
Visibility: export
fromString : (s : String) ->IBuffer (cast (stringByteLengths))
  Convert an UTF-8 string to an immutable byte array.

Totality: total
Visibility: export
toString : IBuffern-> (off : Nat) -> (len : Nat) -> {auto0_ : LTE (off+len) n} ->String
  Convert a section of an immutable byte array to an UTF-8 string.

Totality: total
Visibility: export
unsafeGetBuffer : IBuffern->Buffer
  Extracts the inner buffer held by an immutable byte array without copying.

This allows us to write efficiently write the data to a file
without copying it first. This is a highly unsafe operation,
and client code must make sure never ever to mutate the buffer!

Totality: total
Visibility: export
unsafeMakeBuffer : Buffer->IBufferk
  Wraps a bare mutable buffer in an `IBuffer`.

Client code is responsible to make sure the original buffer is no longer
used.

Totality: total
Visibility: export
recordAnyBuffer : Type
Totality: total
Visibility: public export
Constructor: 
AB : (size : Nat) ->IBuffersize->AnyBuffer

Projections:
.ibuf : ({rec:0} : AnyBuffer) ->IBuffer (size{rec:0})
.size : AnyBuffer->Nat

Hints:
CastAnyBufferString
EqAnyBuffer
FromStringAnyBuffer
MonoidAnyBuffer
OrdAnyBuffer
SemigroupAnyBuffer
ShowAnyBuffer
.size : AnyBuffer->Nat
Totality: total
Visibility: public export
size : AnyBuffer->Nat
Totality: total
Visibility: public export
.ibuf : ({rec:0} : AnyBuffer) ->IBuffer (size{rec:0})
Totality: total
Visibility: public export
ibuf : ({rec:0} : AnyBuffer) ->IBuffer (size{rec:0})
Totality: total
Visibility: public export
dataMBuffer : Type->Nat->Type
  A mutable byte array.

Totality: total
Visibility: export
Constructor: 
MB : Buffer->MBuffersn
0IOBuffer : Nat->Type
  Convenience alias for `MBuffer' RIO`

Totality: total
Visibility: public export
unsafeMBuffer : Buffer->MBuffersn
  Wraps a `Buffer` in an `IOBuffer`. Use at your own risk.

Totality: total
Visibility: export
unsafeFromMBuffer : MBuffersn->Buffer
  Extracts the `Buffer` from an `MBuffer`. Use at your own risk.

Totality: total
Visibility: export
mbuffer1 : (n : Nat) ->F1s (MBuffersn)
  Creates a new mutable byte array bound to linear computation `s`.

Totality: total
Visibility: export
mbuffer : Lift1sf=> (n : Nat) ->f (MBuffersn)
  Creates a new mutable byte array in `IO`.

Totality: total
Visibility: export
set : MBuffersn->Finn->Bits8->F1's
  Safely write a value to a mutable byte array.

Totality: total
Visibility: export
get : MBuffersn->Finn->F1sBits8
  Safely read a value from a mutable byte array.

Totality: total
Visibility: export
modify : MBuffersn->Finn-> (Bits8->Bits8) ->F1's
  Safely modify a value in a mutable byte array.

Totality: total
Visibility: export
bufString : MBuffersn-> (m : Nat) -> {auto0_ : LTEmn} ->F1sString
  Extracts a string from a (possibly partially) filled mutable byte array.

Totality: total
Visibility: export
bufStringFromTill : MBuffersn-> (from : Nat) -> (till : Nat) -> {auto0_ : LTEfromtill} -> {auto0_ : LTEtilln} ->F1sString
  Like `bufString` but extracts a substring from position
`from` up to but not including position `till`.

Totality: total
Visibility: export
bufStringFromTo : MBuffersn-> (from : Nat) -> (to : Nat) -> {auto0_ : LTEfromto} -> {auto0_ : LTton} ->F1sString
  Like `bufString` but extracts a substring from position
`from` up to and including position `to`.

Totality: total
Visibility: export
mtake : MBuffersn-> (0m : Nat) -> {auto0_ : LTEmn} ->F1s (MBuffersm)
  Wraps a mutable byte array in a shorter one.

Totality: total
Visibility: export
0WithMBuffer : Nat->Type->Type
Totality: total
Visibility: public export
alloc : (n : Nat) ->WithMBufferna->a
  Allocate and potentially freeze a mutable byte array in a linear context.

Totality: total
Visibility: export
copy : MBuffersm-> (srcOffset : Nat) -> (dstOffset : Nat) -> (len : Nat) -> {auto0_ : LTE (srcOffset+len) m} -> {auto0_ : LTE (dstOffset+len) n} ->MBuffersn->F1's
Totality: total
Visibility: export
icopy : IBufferm-> (srcOffset : Nat) -> (dstOffset : Nat) -> (len : Nat) -> {auto0_ : LTE (srcOffset+len) m} -> {auto0_ : LTE (dstOffset+len) n} ->MBuffersn->F1's
Totality: total
Visibility: export
bufSubstring : MBuffersn-> (off : Nat) -> (len : Nat) -> {auto0_ : LTE (off+len) n} ->F1s (IBufferlen)
  Extracts an immutable sub-array from a mutable byte array.

Totality: total
Visibility: export
bufSubstringFromTill : MBuffersn-> (from : Nat) -> (till : Nat) -> {auto0_ : LTEfromtill} -> {auto0_ : LTEtilln} ->F1s (IBuffer (minustillfrom))
  Like `bufSubstring` but extracts a substring from position
`from` up to but not including position `till`.

Totality: total
Visibility: export
bufSubstringFromTo : MBuffersn-> (from : Nat) -> (to : Nat) -> {auto0_ : LTEfromto} -> {auto0_ : LTton} ->F1s (IBuffer (minus (Sto) from))
  Like `bufSubstring` but extracts a substring from position
`from` up to and including position `to`.

Totality: total
Visibility: export
thaw : IBuffern->F1s (MBuffersn)
  Copy the content of an immutable byte array to a new byte array.

Totality: total
Visibility: export
unsafeFreezeLTE : MBuffersn-> (0m : Nat) -> {auto0_ : LTEmn} ->F1s (IBufferm)
  Wrap a mutable byte array in an immutable byte array without copying.

In order to make this safe, the associated linear token has to
be discarded.

It is safe to only use a prefix of a properly constructed array,
therefore we are free to give the resulting array a smaller size.
Most of the time, we'd like to use the whole buffer, in which case
we can just use `freezeBufAt`.

Note: For reasons of efficiency, this does not copy the buffer,
and therefore, it must no longer be modified after calling
this function.

Totality: total
Visibility: export
unsafeFreeze : MBuffersn->F1s (IBuffern)
  Convenience alias for `unsafeFreezeLTE @{reflexive}`

Totality: total
Visibility: export
freezeLTE : MBuffersn-> (m : Nat) -> {auto0_ : LTEmn} ->F1s (IBufferm)
  Copy a prefix of a mutable byte arrya into an immutable byte array.

Totality: total
Visibility: export
freeze : MBuffersn->F1s (IBuffern)
  Copy a mutable byte array into an immutable byte array.

Totality: total
Visibility: export
readIBuffer : HasIOio=>Nat->File->io (EitherFileError (n : Nat**IBuffern))
  Read up to `n` bytes from a file into an immutable byte array.

Totality: total
Visibility: export
writeIBuffer : HasIOio=>File-> (offset : Nat) -> (len : Nat) ->IBuffern-> {auto0_ : LTE (offset+len) n} ->io (Either (FileError, Int) ())
  Write up to `len` bytes from an immutable byte array to a file, starting
at the given offset.

Totality: total
Visibility: export
writeMBuffer : HasIOio=>File-> (offset : Nat) -> (len : Nat) -> {auto0_ : LTE (offset+len) n} ->MBuffersn->io (Either (FileError, Int) ())
  Write up to `len` bytes from a mutable byte array to a file, starting
at the given offset.

Totality: total
Visibility: export