Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Catalog · How the catalog works

Random project

Dust

Implements Rust-like types for Delphi

View on GitHub

Anyone may press Interesting, signed in or not. It helps others find this project.

Member rating

No ratings yet.

Sign in to rate this project.

README

Dust

Implements Rust-like types for Delphi

This is a very single interpretation of how things should be. Be free and keep your mind free.

How to use

pascal
uses std.dust;

var task: Option<String>;
var content: Result<String, Exception>;

Practical example

pascal
var today := now();
task := TaskRepository.Load(today);
  case task.match
    Some: Showmessage('That is for today: ' + task.value)
    else Showmessage('Take a day off')
  end;
pascal
const
  filename = '/InvalidFilename.pdf';

content := TFileRepository.OpenAsString(filename);
case content.match of
  Ok: Showmessage('That is the file content: ' + content.value);
  Err: Showmessage('That was not good, look: ' + content.err.message)
end;