Decouple exception catch from Str::Repr
diff --git a/gen/src/write.rs b/gen/src/write.rs
index 3b404c6..16bb7cd 100644
--- a/gen/src/write.rs
+++ b/gen/src/write.rs
@@ -322,25 +322,31 @@
         writeln!(out, "}};");
     }
 
+    out.begin_block("namespace");
+
+    if needs_trycatch || needs_rust_error {
+        out.begin_block("namespace repr");
+        writeln!(out, "struct PtrLen final {{");
+        writeln!(out, "  const char *ptr;");
+        writeln!(out, "  size_t len;");
+        writeln!(out, "}};");
+        out.end_block("namespace repr");
+    }
+
     if needs_rust_error {
-        out.begin_block("namespace");
         writeln!(out, "template <>");
         writeln!(out, "class impl<Error> final {{");
         writeln!(out, "public:");
-        writeln!(out, "  struct Repr final {{");
-        writeln!(out, "    const char *msg;");
-        writeln!(out, "    size_t len;");
-        writeln!(out, "  }};");
-        writeln!(out, "  static Error error(Repr repr) noexcept {{");
+        writeln!(out, "  static Error error(repr::PtrLen repr) noexcept {{");
         writeln!(out, "    Error error;");
-        writeln!(out, "    error.msg = repr.msg;");
+        writeln!(out, "    error.msg = repr.ptr;");
         writeln!(out, "    error.len = repr.len;");
         writeln!(out, "    return error;");
         writeln!(out, "  }}");
         writeln!(out, "}};");
-        out.end_block("namespace");
     }
 
+    out.end_block("namespace");
     out.end_block("namespace cxxbridge05");
 
     if needs_trycatch {
@@ -526,7 +532,7 @@
         write!(out, "{} ", annotation);
     }
     if efn.throws {
-        write!(out, "::rust::Str::Repr ");
+        write!(out, "::rust::repr::PtrLen ");
     } else {
         write_extern_return_type_space(out, &efn.ret);
     }
@@ -598,7 +604,7 @@
     writeln!(out, ";");
     write!(out, "  ");
     if efn.throws {
-        writeln!(out, "::rust::Str::Repr throw$;");
+        writeln!(out, "::rust::repr::PtrLen throw$;");
         writeln!(out, "  ::rust::behavior::trycatch(");
         writeln!(out, "      [&] {{");
         write!(out, "        ");
@@ -711,7 +717,7 @@
     indirect_call: bool,
 ) {
     if sig.throws {
-        write!(out, "::rust::impl<::rust::Error>::Repr ");
+        write!(out, "::rust::repr::PtrLen ");
     } else {
         write_extern_return_type_space(out, &sig.ret);
     }
@@ -849,7 +855,7 @@
         }
     }
     if sig.throws {
-        write!(out, "::rust::impl<::rust::Error>::Repr error$ = ");
+        write!(out, "::rust::repr::PtrLen error$ = ");
     }
     write!(out, "{}(", invoke);
     if sig.receiver.is_some() {
@@ -896,7 +902,7 @@
     }
     writeln!(out, ";");
     if sig.throws {
-        writeln!(out, "  if (error$.msg) {{");
+        writeln!(out, "  if (error$.ptr) {{");
         writeln!(out, "    throw ::rust::impl<::rust::Error>::error(error$);");
         writeln!(out, "  }}");
     }