Skip to content

Commit 60d6e3f

Browse files
committed
Add comments and indent chained method calls.
1 parent 2ad4d0d commit 60d6e3f

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

ci/LDKSwift/Sources/LDKSwift/batteries/ChannelManagerConstructor.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,12 @@ enum RouterUnavailableError: Error {
2323
case channelManagerInitializationMissingScorerOrNetworkGraph
2424
}
2525

26+
/// Argument used when deserializing ChannelManager instances. If the user has previously already taken it upon themselves to deserialize the NetworkGraph, the `instance`
27+
/// case may be used. Otherwise, `serialized` may be passed to have the deserializer handle the NetworkGraph, too.
2628
public enum NetworkGraphArgument {
29+
/// Use if you have a serialized NetworkGraph that should be deserialized.
2730
case serialized([UInt8])
31+
/// Use if you have already deserialized a NetworkGraph and wish to pass that instance here.
2832
case instance(NetworkGraph)
2933
}
3034

src/generation/base_type_generator.mts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export abstract class BaseTypeGenerator<Type extends RustType> {
4545
generate(type: Type) {
4646
const fileName = this.swiftTypeName(type) + '.swift';
4747
const fileContents = this.generateFileContents(type)
48-
.replaceAll('#{swift_class_name}', fileName);
48+
.replaceAll('#{swift_class_name}', fileName);
4949
this.persist(type, fileContents);
5050
}
5151

@@ -202,7 +202,7 @@ export abstract class BaseTypeGenerator<Type extends RustType> {
202202
}
203203

204204
let instantiationContext = '"#{swift_class_name}::\\(#function):\\(#line)"';
205-
if(semantics.isConstructor && containerType && this.isElidedType(containerType)){
205+
if (semantics.isConstructor && containerType && this.isElidedType(containerType)) {
206206
swiftMethodArguments.push('instantiationContext: String');
207207
instantiationContext = 'instantiationContext';
208208
}
@@ -1072,8 +1072,15 @@ export abstract class BaseTypeGenerator<Type extends RustType> {
10721072
}
10731073

10741074
return `
1075+
/// Set to false to suppress an individual type's deinit log statements.
1076+
/// Only applicable when log threshold is set to \`.Debug\`.
10751077
public static var enableDeinitLogging = true
1078+
1079+
/// Set to true to suspend the freeing of this type's associated Rust memory.
1080+
/// Should only ever be used for debugging purposes, and will likely be
1081+
/// deprecated soon.
10761082
public static var suspendFreedom = false
1083+
10771084
private static var instanceCounter: UInt = 0
10781085
internal let instanceNumber: UInt
10791086

src/generation/bindings_file_generator.mts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,20 @@ export default class BindingsFileGenerator extends BaseTypeGenerator<GlobalBindi
2424
const swiftMethodName = this.swiftMethodName(currentMethod.method);
2525
const methodCode = this.generateMethod(currentMethod.method);
2626
const renamedMethodCode = methodCode
27-
.replace(swiftMethodName, currentMethod.swiftName);
27+
.replace(swiftMethodName, currentMethod.swiftName);
2828
generatedMethods += Generator.reindentCode(renamedMethodCode, 4);
2929
}
3030

3131
let generatedTupleTypeAliases = '';
3232
let generatedTupleConverters = '';
33-
let generatedTupleComparators = ''
33+
let generatedTupleComparators = '';
3434

3535
for (const [rawSwiftTypeSignature, tupleSizes] of Object.entries(this.auxiliaryArtifacts.tuples)) {
3636
for (const currentTupleSize of tupleSizes) {
3737
const tupleTypeName = `${rawSwiftTypeSignature}Tuple${currentTupleSize}`;
3838
generatedTupleTypeAliases += `
3939
internal typealias ${tupleTypeName} = (${Array(currentTupleSize).fill(rawSwiftTypeSignature)
40-
.join(', ')})
40+
.join(', ')})
4141
`;
4242

4343
let tupleResultComponents = [];
@@ -46,7 +46,7 @@ export default class BindingsFileGenerator extends BaseTypeGenerator<GlobalBindi
4646
for (let i = 0; i < currentTupleSize; i++) {
4747
tupleResultComponents.push(`array[${i}]`);
4848
arrayResultComponents.push(`tuple.${i}`);
49-
comparator.push(`tupleA.${i} == tupleB.${i}`)
49+
comparator.push(`tupleA.${i} == tupleB.${i}`);
5050
}
5151

5252
generatedTupleConverters += `

0 commit comments

Comments
 (0)