Requests Documentation

Structure Any​Storage

public struct AnyStorage<Item: Storable>  

A struct defining a type-erased instance of Storage.

%33 AnyStorage AnyStorage Sequence Sequence AnyStorage->Sequence Storage Storage AnyStorage->Storage

Conforms To

Sequence
Storage

Initializers

init(_:​)

public init<S: Storage>(_ storage: S) where S.Item == Item  

Init.

Parameters

storage S

Some Storage.

Methods

make​Iterator()

public func makeIterator() -> AnyIterator<Item>  

Compose the iterator.

Returns

Some IteratorProtocol.

insert(_:​)

@discardableResult
    public func insert(_ item: Item) throws -> (inserted: Bool, memberAfterInsert: Item)  

Insert a new item.

Parameters

item Item

Some Item.

Returns

A tuple indicating whether a previous value existed, and what this value was.

remove​Value(for​Key:​)

@discardableResult
    public func removeValue(forKey key: Item.ID) throws -> Item?  

Remove the associated item, if it exists.

Parameters

key Item.​ID

Some Item.ID.

Throws

Any Error.

Returns

The removed Item, if it exists.

remove​All()

public func removeAll() throws  

Remove all associated items.