Skip to content

Commit

Permalink
Inlining
Browse files Browse the repository at this point in the history
  • Loading branch information
ra1028 committed Aug 21, 2018
1 parent e6fe3c0 commit 41bbcdc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Sources/ArraySection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ public struct ArraySection<Model: Differentiable, Element: Differentiable>: Diff

/// An identifier value that of model for difference calculation.
public var differenceIdentifier: Model.DifferenceIdentifier {
return model.differenceIdentifier
@inline(__always) get { return model.differenceIdentifier }
}

/// Creates a section from the model and the elements.
///
/// - Parameters:
/// - model: A differentiable model of section.
/// - elements: The collection of element in the section.
@inline(__always)
public init<C: Collection>(model: Model, elements: C) where C.Element == Element {
self.model = model
self.elements = Array(elements)
Expand All @@ -28,6 +29,7 @@ public struct ArraySection<Model: Differentiable, Element: Differentiable>: Diff
/// - Parameters:
/// - source: A source section to reproduce.
/// - elements: The collection of elements for the new section.
@inline(__always)
public init<C: Collection>(source: ArraySection, elements: C) where C.Element == Element {
self.init(model: source.model, elements: elements)
}
Expand All @@ -42,6 +44,7 @@ public struct ArraySection<Model: Differentiable, Element: Differentiable>: Diff
///
/// - Returns: A Boolean value indicating whether the content of `self` is equals
/// to the content of the given source section.
@inline(__always)
public func isContentEqual(to source: ArraySection) -> Bool {
return model.isContentEqual(to: source.model)
}
Expand Down
1 change: 1 addition & 0 deletions Sources/ElementPath.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public struct ElementPath: Hashable {
/// - Parameters:
/// - element: The element index (or offset).
/// - section: The section index (or offset).
@inline(__always)
public init(element: Int, section: Int) {
self.element = element
self.section = section
Expand Down

0 comments on commit 41bbcdc

Please sign in to comment.