Core Library0.xAPI Reference

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

method libtmux-swift latest

ControlNotificationStream.dropFirst(_:)

Omits a specified number of elements from the base asynchronous sequence, then passes through all remaining elements.

Source and package
Qualified name
ControlNotificationStream.dropFirst(_:)
Declared in
ControlNotificationStream
Package
libtmux-swift
dropFirst(count: Int) -> AsyncDropFirstSequence<Self>

Inherited from AsyncSequence.dropFirst(_:)

Description#

Use dropFirst(_:) when you want to drop the first n elements from the base sequence and pass through the remaining elements.

In this example, an asynchronous sequence called Counter produces Int values from 1 to 10. The dropFirst(_:) method causes the modified sequence to ignore the values 1 through 3, and instead emit 4 through 10:

for await number in Counter(howHigh: 10).dropFirst(3) { print(number, terminator: " ") } // Prints "4 5 6 7 8 9 10 "

If the number of elements to drop exceeds the number of elements in the sequence, the result is an empty sequence.

  • Parameter count: The number of elements to drop from the beginning of the sequence. count must be greater than or equal to zero.
  • Returns: An asynchronous sequence that drops the first count elements from the base sequence.
Parameters
Esc

Type to search.

Reference previewOpen reference