Files
sakurac/core/traits/pointer.sakura
T

23 lines
884 B
Plaintext
Raw Normal View History

2026-10-26 10:14:11 -05:00
#! @file pointer.sakura
#! @author John Christman (sorakatadzuma@gmail.com)
#! @copyright Malunal Studios, LLC.
#! @license MIT
#!
#! Contains the pointer trait, which the compiler gives every pointer type.
module core;
#! A pointer, whatever it points at, however many pointers deep.
#!
#! A pointer is an address. It is compared, ordered, and hashed as one, starts
#! as `null`, and moves by whole elements, so `p + 1` is the element after `p`,
#! and two pointers subtract to the number of elements between them. Nothing of
#! what it points at is reached through it: `*p`, `p[i]`, and `through(p)` reach
#! that.
#!
#! A type parameter bounded by `pointer` has what pointers have, as `equatable`,
#! `ordered`, and `zeroable` give, along with moving by an integer and
#! subtracting. The compiler decides what is a pointer, so no type can implement
#! it.
pub trait pointer {}