Contents

Span

Span<Element> represents a contiguous region of memory which contains initialized instances of Element.

Declaration

@frozen struct Span<Element> where Element : ~Copyable

Overview

A Span instance is a non-owning, non-escaping view into memory. When a Span is created, it inherits the lifetime of the container owning the contiguous memory, ensuring temporal safety and avoiding use-after-free errors. Operations on Span are bounds-checked, ensuring spatial safety and avoiding buffer overflow errors.

Topics

Initializers

Instance Properties

Instance Methods

Subscripts

Type Aliases

See Also

Safe Memory Access