std::unit
The Unit type: no meaningful value.
Unit is the return type of functions called for their effect
(io.print, timer.sleep, Iter.each). There is exactly one Unit
value and it carries no information, so there is nothing to construct or
inspect.
Unit has no Display impl, so rendering one ("${Unit}",
Display.to_string(Unit)) is a compile error. Its Debug form is Unit.
Import with import std::unit.
Exports
Section titled “Exports”Types
type Unit
Section titled “type Unit”type Unit
No meaningful value. Functions called for their effect, such as
io.print, return it. Unit is Equatable and Hashable: its one
value equals itself and always hashes the same, so a tuple, struct or
collection
holding Unit can be compared, hashed, kept in a Set or used as a
Map key.
assert Unit == Unit
assert Equatable.equal(Unit, Unit)
assert Hashable.hash(Unit) == Hashable.hash(Unit)
Unit.equal
Section titled “Unit.equal”impl Equatable for Unit
fn equal(_a: Unit, _b: Unit) -> Bool
impl Equatable.equal
Unit.hash
Section titled “Unit.hash”impl Hashable for Unit
fn hash(_value: Unit) -> Int
impl Hashable.hash
Unit.inspect
Section titled “Unit.inspect”impl Debug for Unit
fn inspect(value: Unit) -> String
impl Debug.inspect