package grace

  1. Overview
  2. Docs

Module Source.ReaderSource

Sourcetype t = {
  1. id : int;
    (*

    The unique identifier of the reader. Equality, comparison, hashing are all performed on this identifier.

    *)
  2. name : string option;
    (*

    The name of the reader. The diagnostic render can use the name of the reader in place of a file path.

    *)
  3. length : int;
    (*

    The length (in bytes) of the source.

    *)
  4. unsafe_get : int -> char;
    (*

    unsafe_get i reads the ith byte without performing bounds checks.

    *)
}

A reader denotes an arbitrary byte source (potentially backed by a file, buffer, socket, etc).

include Sexplib0.Sexpable.S with type t := t
Sourceval t_of_sexp : Sexplib0.Sexp.t -> t
Sourceval sexp_of_t : t -> Sexplib0.Sexp.t
include Grace_std.Comparable.S with type t := t
Sourceval (>=) : t -> t -> bool
Sourceval (<=) : t -> t -> bool
Sourceval (>) : t -> t -> bool
Sourceval (<) : t -> t -> bool
Sourceval (=) : t -> t -> bool
Sourceval (<>) : t -> t -> bool
Sourceval compare : t -> t -> int
Sourceval equal : t -> t -> bool
Sourceval min : t -> t -> t
Sourceval max : t -> t -> t
Sourceval name : t -> string

name reader returns the name of the reader. If reader.name is None, then identifier reader.id (converted to a string) is returned.