fswalk

Types

pub type Entry {
  Entry(filename: String, stat: Stat)
}

Constructors

  • Entry(filename: String, stat: Stat)
pub type EntryFilter =
  fn(Entry) -> Bool

Private. Pending gleam/issues/2486

pub opaque type Non

Private. Pending gleam/issues/2486

pub opaque type Som

Weak stat implementation.

pub type Stat {
  Stat(is_directory: Bool)
}

Constructors

  • Stat(is_directory: Bool)

See builder.

pub opaque type WalkBuilder(filter, path)

Functions

pub fn builder() -> WalkBuilder(Non, Non)

Create a new WalkBuilder

pub fn each(it: Iterator(a), fun: fn(a) -> b) -> Nil

Sugar method for consuming the walk iterator instance

pub fn fold(it: Iterator(a), init: b, fun: fn(b, a) -> b) -> b

Sugar method for consuming the walk iterator instance

pub fn map(it: Iterator(a), fun: fn(a) -> b) -> Iterator(b)

Sugar method for consuming the walk iterator instance

pub fn walk(
  builder: WalkBuilder(a, Som),
) -> Iterator(Result(Entry, FileError))

Walks the filesystem lazily.

pub fn with_filter(
  builder: WalkBuilder(a, b),
  filter: fn(Entry) -> Bool,
) -> WalkBuilder(Som, b)

Create a new WalkBuilder bound to a filter function. The filter should only expect directories passed in the Entry instances.

pub fn with_path(
  builder: WalkBuilder(a, b),
  path: String,
) -> WalkBuilder(a, Som)

Create a new WalkBuilder bound to a directory path to walk

Search Document