componentized

Synthetic sample. This package shows how the directory renders each WIT feature. It isn't published to any registry.

A counter, counting up from zero by any amount, or back to it.

Functions

functionget: func() -> u64

The current count, now wide enough to never wrap.

functionincrement: func()

Adds one to the count.

functionreset: func()

Sets the count back to zero.

functionadd: func(n: u64)

Adds to the count.

functionsubtract: func(n: u64)

Subtracts from the count, never below zero, in a 1.3 that was never released.

WIT

/// A counter, counting up from zero by any amount, or back to it.
interface counter {
  /// The current count, now wide enough to never wrap.
  get: func() -> u64;

  /// Adds one to the count.
  increment: func();

  /// Sets the count back to zero.
  reset: func();

  /// Adds to the count.
  add: func(n: u64);

  /// Subtracts from the count, never below zero, in a 1.3 that was never released.
  subtract: func(n: u64);
}