RedundancyAliasingStrategy
public protocol RedundancyAliasingStrategy : AnyObject
A class-bound protocol which implements a strategy for detecting aliasable values in a YAML document. Implementations should return RedundancyAliasingOutcome.anchor(…) for the first occurrence of a value. Subsequent occurrences of the same value (where same-ness is defined by the implementation) should return RedundancyAliasingOutcome.alias(…) where the contained Anchor has the same value as the previously returned RedundancyAliasingOutcome.anchor(…). Its the identity of the Anchor values returned that ultimately informs the YAML encoder when to use aliases. N,B. It is essential that implementations release all references to Anchors which are created by this type when releaseAnchorReferences() is called by the Encoder. After this call the implementation will no longer be referenced by the Encoder and will itself be released.
-
Implementations should return RedundancyAliasingOutcome.anchor(…) for the first occurrence of a value. Subsequent occurrences of the same value (where same-ness is defined by the implementation) should return RedundancyAliasingOutcome.alias(…) where the contained Anchor has the same value as the previously returned RedundancyAliasingOutcome.anchor(…). Its the identity of the Anchor values returned that ultimately informs the YAML encoder when to use aliases.
Declaration
Swift
func alias(for encodable: any Encodable) throws -> RedundancyAliasingOutcome
-
It is essential that implementations release all references to Anchors which are created by this type when releaseAnchorReferences() is called by the Encoder. After this call, the implementation will no longer be referenced by the Encoder and will itself be released.
Declaration
Swift
func releaseAnchorReferences() throws