Function init [src]

Create a new Rational. A small amount of memory will be allocated on initialization. This will be 2 * Int.default_capacity.

Prototype

pub fn init(a: Allocator) !Rational

Parameters

a: Allocator

Source

pub fn init(a: Allocator) !Rational { var p = try Int.init(a); errdefer p.deinit(); return Rational{ .p = p, .q = try Int.initSet(a, 1), }; }