Files
swift-mirror/stdlib/common/MirrorConformance.gyb
Dave Abrahams dbde275230 [stdlib] Propagate Reflectable docs
230 undocumented public non-operator APIs remain in core

Swift SVN r22236
2014-09-23 23:08:43 +00:00

34 lines
1.6 KiB
Swift

%{
#//===--- MirrorConformance.gyb --------------------------------*- swift -*-===//
#//
#// This source file is part of the Swift.org open source project
#//
#// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
#// Licensed under Apache License v2.0 with Runtime Library Exception
#//
#// See http://swift.org/LICENSE.txt for license information
#// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
#//
#//===----------------------------------------------------------------------===//
# This file contains boilerplate that is common among all the Mirrors in the
# Swift Standard Library. It is meant to be used as a template to be included
# in other .gyb files to generate actual Mirror implementations, by only typing
# as little code as necessary
# Instructions:
# Load the file as a gyb template
# When you want to generate a Mirror, execute this template. Locals are as follows:
# - introspecteeType: the base name of the type to be reflected by your Mirror
# - genericArgs: a list of names of generic argument types that you need for your Mirror
# - genericConstraints: a dictionary that contains constraints on generic argument types
# - disposition: a valid disposition for your Mirror
# You still need to provide count, subscript, summary and quickLookObject manually when using
# this template, which is probably reasonable since those are "the meat" of every Mirror
}%
extension ${introspecteeType} : Reflectable {
/// Returns a mirror that reflects `self`.
public func getMirror() -> MirrorType {
return _${introspecteeType}Mirror(self)
}
}