Skip to content
Kavachकवच

Standard Library: std.clipboard

● Intermediate5 min

Every type, method and function of std.clipboard: what the spec lists, then each declaration in its source, with its examples and the line that declares it.

Spec 14.17 · learn it in Clipboard.

A declaration below shows what a program writes against: a type's fields, a function's parameters, what it gives, its contracts (require, ensure) and its examples. kavach test runs every example, so each one is true of the code.

What the spec lists

FunctionGives
clipboard.read_text() -> String ! ClipboardError uses ClipboardThe clipboard's text; fails with Empty when it holds none
clipboard.write_text(text) ! ClipboardError uses ClipboardPuts text on the clipboard, in place of what was there

std.clipboard · clipboard.kav

use std.clipboard: 1 type and 0 functions. stdlib/clipboard/clipboard.kav

ClipboardError type

Why the clipboard couldn't be read or written.

pub type ClipboardError = Empty | Unavailable(reason: String)