Skip to content

ValueOwnership

Azoy edited this page May 6, 2021 · 2 revisions

ValueOwnership

A discriminator to determine what the ownership rules are (currently) for a function parameter.

public enum ValueOwnership: UInt8 

Inheritance

UInt8

Enumeration Cases

`default`

The default ownership rule for all Swift parameters, which might mean shared or owned.

case `default` = 0

`inout`

Inout refers to passing a value by reference for mutation.

case `inout` = 1

shared

Shared refers to passing a value by reference, but without mutation. Similar to Rust's immutable borrow.

case shared = 2

owned

Owned refers to passing a value via copy.

case owned = 3
Types
Protocols
Global Variables
Global Functions
Clone this wiki locally