From 726791a4d40ffdf940c5882e2700e60dff594de3 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Fri, 24 Jul 2026 14:52:18 +0100 Subject: Move mapErr methods to end of class --- .../rusttransient0/RustTransient0Generator.java | 62 +++++++++++----------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/rusttransient0/RustTransient0Generator.java b/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/rusttransient0/RustTransient0Generator.java index 700b74f..7f1449b 100644 --- a/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/rusttransient0/RustTransient0Generator.java +++ b/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/rusttransient0/RustTransient0Generator.java @@ -272,37 +272,6 @@ public class RustTransient0Generator implements Generator { ); } - private RustExpression mapErrToInvalidData(RustExpression result) { - return mapErr( - result, - error -> new RustCallExpression( - RustPath.global("std", "io", "Error", "new"), - List.of( - RustPath.global("std", "io", "ErrorKind", "InvalidData"), - RustPath.of(error) - ) - ) - ); - } - - private RustExpression mapErr( - RustExpression result, - Function func - ) { - var error = RustIdentifier.of("error"); - - return methodCall( - result, - RustIdentifier.of("map_err"), - List.of( - new RustClosureExpression( - List.of(new RustIdentifierPattern(error)), - func.apply(error) - ) - ) - ); - } - private RustModule generateNamespace(TypedNamespaceNode namespace) { var namespaceName = namespace.namespaceName(); var moduleName = generateTransient0ModuleName(namespaceName); @@ -903,4 +872,35 @@ public class RustTransient0Generator implements Generator { ) )); } + + private RustExpression mapErrToInvalidData(RustExpression result) { + return mapErr( + result, + error -> new RustCallExpression( + RustPath.global("std", "io", "Error", "new"), + List.of( + RustPath.global("std", "io", "ErrorKind", "InvalidData"), + RustPath.of(error) + ) + ) + ); + } + + private RustExpression mapErr( + RustExpression result, + Function func + ) { + var error = RustIdentifier.of("error"); + + return methodCall( + result, + RustIdentifier.of("map_err"), + List.of( + new RustClosureExpression( + List.of(new RustIdentifierPattern(error)), + func.apply(error) + ) + ) + ); + } } -- cgit v1.2.3