glendix/define/file_boundary

Provides typed filesystem operations for the widget definition editor.

Types

Describes a widget definition filesystem failure.

pub type FileError {
  WidgetNameWasNotDeclared(path: String)
  WidgetXmlWasNotFound(path: String)
  FileCouldNotBeRead(path: String, reason: String)
  FileCouldNotBeWritten(path: String, reason: String)
}

Constructors

  • WidgetNameWasNotDeclared(path: String)

    The current package does not declare a widget name.

  • WidgetXmlWasNotFound(path: String)

    The expected widget XML file does not exist.

  • FileCouldNotBeRead(path: String, reason: String)

    A file could not be read.

  • FileCouldNotBeWritten(path: String, reason: String)

    A file could not be written.

Values

pub fn find_widget_xml() -> Result(String, FileError)

Finds the widget XML path declared by the current package.

pub fn read(path path: String) -> Result(String, FileError)

Reads a UTF-8 text file.

pub fn write(
  path path: String,
  content content: String,
) -> Result(Nil, FileError)

Writes a UTF-8 text file.

Search Document