MarkedCircularBuffer
public struct MarkedCircularBuffer<Element> : CustomStringConvertible
extension MarkedCircularBuffer: Collection, MutableCollection
extension MarkedCircularBuffer: RandomAccessCollection
A circular buffer that allows one object at a time to be “marked” and easily identified and retrieved later.
This object is used extensively within SwiftNIO to handle flushable buffers. It can be used to store buffered writes and mark how far through the buffer the user has flushed, and therefore how far through the buffer is safe to write.
-
Create a new instance.
- paramaters:
- initialCapacity: The initial capacity of the internal storage.
Declaration
Swift
@inlinable public init(initialCapacity: Int)
- paramaters:
-
Appends an entry to the buffer, expanding it if needed.
Declaration
Swift
@inlinable public mutating func append(_ value: Element)
-
Removes the first element from the buffer.
Declaration
Swift
@inlinable public mutating func removeFirst() -> Element
-
Undocumented
Declaration
Swift
@inlinable public mutating func popFirst() -> Element?
-
The first element in the buffer.
Declaration
Swift
@inlinable public var first: Element? { get }
-
If the buffer is empty.
Declaration
Swift
@inlinable public var isEmpty: Bool { get }
-
The number of elements in the buffer.
Declaration
Swift
@inlinable public var count: Int { get }
-
Declaration
Swift
@inlinable public var description: String { get }
-
Marks the buffer at the current index, making the last index in the buffer marked.
Declaration
Swift
@inlinable public mutating func mark()
-
Returns true if the buffer is currently marked at the given index.
Declaration
Swift
@inlinable public func isMarked(index: Index) -> Bool
-
Returns the index of the marked element.
Declaration
Swift
@inlinable public var markedElementIndex: Index? { get }
-
Returns the marked element.
Declaration
Swift
@inlinable public var markedElement: Element? { get }
-
Returns true if the buffer has been marked at all.
Declaration
Swift
@inlinable public var hasMark: Bool { get }
-
Undocumented
Declaration
Swift
public typealias RangeType<Bound> = Range<Bound> where Bound : Strideable, Bound.Stride : SignedInteger
-
Declaration
Swift
public typealias Index = CircularBuffer<Element>.Index
-
Declaration
Swift
public typealias SubSequence = CircularBuffer<Element>
-
-
Declaration
Swift
@inlinable public var startIndex: Index { get }
-
Declaration
Swift
@inlinable public var endIndex: Index { get }
-
Retrieves the element at the given index from the buffer, without removing it.
Declaration
Swift
@inlinable public subscript(index: Index) -> Element { get set }
-
Declaration
Swift
@inlinable public subscript(bounds: Range<Index>) -> SubSequence { get }
-
-
-