No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

FixedStringFormatMethods.gen.cs 43KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675
  1. 
  2. //------------------------------------------------------------------------------
  3. // <auto-generated>
  4. // This code was generated by a tool.
  5. //
  6. // TextTransform Samples/Packages/com.unity.collections/Unity.Collections/FixedStringFormatMethods.tt
  7. //
  8. // Changes to this file may cause incorrect behavior and will be lost if
  9. // the code is regenerated.
  10. // </auto-generated>
  11. //------------------------------------------------------------------------------
  12. using System;
  13. using Unity.Collections.LowLevel.Unsafe;
  14. namespace Unity.Collections
  15. {
  16. /// <summary>
  17. /// Provides extension methods for FixedString*N*Bytes.
  18. /// </summary>
  19. public unsafe static partial class FixedStringMethods
  20. {
  21. /// <summary>
  22. /// Interpolates strings into a format string and appends the result to this string.
  23. /// </summary>
  24. /// <remarks>
  25. /// Similar to `StringBuilder.AppendFormat` but with significant limitations:
  26. /// - Only supports FixedString*N*Bytes arguments. To use other string types, convert them to FixedString*N*Bytes first.
  27. /// - Only supports numeric format placeholders of the form `{0}` .. `{N}`.
  28. /// - No format modifiers (*e.g.* `{0:x}`) are supported.
  29. ///
  30. /// The overloads of this method take up to ten strings to interpolate into the format string.
  31. /// </remarks>
  32. /// <typeparam name="T">A FixedString*N*Bytes type.</typeparam>
  33. /// <typeparam name="U">A FixedString*N*Bytes type.</typeparam>
  34. /// <typeparam name="T0">The type of value to interpolate into the format string.</typeparam>
  35. /// <param name="dest">The string to append to.</param>d
  36. /// <param name="format">A string to be interpolated and appended.</param>
  37. /// <param name="arg0">A FixedString*N*Bytes to interpolate into the format string.</param>
  38. [BurstCompatible(GenericTypeArguments = new[] { typeof(FixedString128Bytes /*T*/), typeof(FixedString128Bytes /*U*/), typeof(FixedString128Bytes /*T0*/) })]
  39. public static unsafe void AppendFormat<T, U, T0>(ref this T dest, in U format, in T0 arg0)
  40. where T : struct, INativeList<byte>, IUTF8Bytes
  41. where U : struct, INativeList<byte>, IUTF8Bytes
  42. where T0 : struct, INativeList<byte>, IUTF8Bytes
  43. {
  44. ref var formatRef = ref UnsafeUtilityExtensions.AsRef(in format);
  45. int formatLength = formatRef.Length;
  46. byte* formatBytes = formatRef.GetUnsafePtr();
  47. for (var i = 0; i < formatLength; ++i)
  48. {
  49. if (formatBytes[i] == (byte)'{')
  50. {
  51. if (formatLength - i >= 3 && formatBytes[i + 1] != (byte)'{')
  52. {
  53. var index = formatBytes[i + 1] - (byte)'0';
  54. switch (index)
  55. {
  56. case 0: dest.Append(in arg0); i+=2; break;
  57. default:
  58. dest.AppendRawByte(formatBytes[i]);
  59. break;
  60. }
  61. }
  62. }
  63. else
  64. dest.AppendRawByte(formatBytes[i]);
  65. }
  66. }
  67. /// <summary>
  68. /// Interpolates strings into a format string and appends the result to this string.
  69. /// </summary>
  70. /// <remarks>
  71. /// Similar to `StringBuilder.AppendFormat` but with significant limitations:
  72. /// - Only supports FixedString*N*Bytes arguments. To use other string types, convert them to FixedString*N*Bytes first.
  73. /// - Only supports numeric format placeholders of the form `{0}` .. `{N}`.
  74. /// - No format modifiers (*e.g.* `{0:x}`) are supported.
  75. ///
  76. /// The overloads of this method take up to ten strings to interpolate into the format string.
  77. /// </remarks>
  78. /// <typeparam name="T">A FixedString*N*Bytes type.</typeparam>
  79. /// <typeparam name="U">A FixedString*N*Bytes type.</typeparam>
  80. /// <typeparam name="T0">The type of value to interpolate into the format string.</typeparam>
  81. /// <typeparam name="T1">The type of value to interpolate into the format string.</typeparam>
  82. /// <param name="dest">The string to append to.</param>d
  83. /// <param name="format">A string to be interpolated and appended.</param>
  84. /// <param name="arg0">A FixedString*N*Bytes to interpolate into the format string.</param>
  85. /// <param name="arg1">A FixedString*N*Bytes to interpolate into the format string.</param>
  86. [BurstCompatible(GenericTypeArguments = new[] { typeof(FixedString128Bytes /*T*/), typeof(FixedString128Bytes /*U*/), typeof(FixedString128Bytes /*T0*/), typeof(FixedString128Bytes /*T1*/) })]
  87. public static unsafe void AppendFormat<T, U, T0, T1>(ref this T dest, in U format, in T0 arg0, in T1 arg1)
  88. where T : struct, INativeList<byte>, IUTF8Bytes
  89. where U : struct, INativeList<byte>, IUTF8Bytes
  90. where T0 : struct, INativeList<byte>, IUTF8Bytes
  91. where T1 : struct, INativeList<byte>, IUTF8Bytes
  92. {
  93. ref var formatRef = ref UnsafeUtilityExtensions.AsRef(in format);
  94. int formatLength = formatRef.Length;
  95. byte* formatBytes = formatRef.GetUnsafePtr();
  96. for (var i = 0; i < formatLength; ++i)
  97. {
  98. if (formatBytes[i] == (byte)'{')
  99. {
  100. if (formatLength - i >= 3 && formatBytes[i + 1] != (byte)'{')
  101. {
  102. var index = formatBytes[i + 1] - (byte)'0';
  103. switch (index)
  104. {
  105. case 0: dest.Append(in arg0); i+=2; break;
  106. case 1: dest.Append(in arg1); i+=2; break;
  107. default:
  108. dest.AppendRawByte(formatBytes[i]);
  109. break;
  110. }
  111. }
  112. }
  113. else
  114. dest.AppendRawByte(formatBytes[i]);
  115. }
  116. }
  117. /// <summary>
  118. /// Interpolates strings into a format string and appends the result to this string.
  119. /// </summary>
  120. /// <remarks>
  121. /// Similar to `StringBuilder.AppendFormat` but with significant limitations:
  122. /// - Only supports FixedString*N*Bytes arguments. To use other string types, convert them to FixedString*N*Bytes first.
  123. /// - Only supports numeric format placeholders of the form `{0}` .. `{N}`.
  124. /// - No format modifiers (*e.g.* `{0:x}`) are supported.
  125. ///
  126. /// The overloads of this method take up to ten strings to interpolate into the format string.
  127. /// </remarks>
  128. /// <typeparam name="T">A FixedString*N*Bytes type.</typeparam>
  129. /// <typeparam name="U">A FixedString*N*Bytes type.</typeparam>
  130. /// <typeparam name="T0">The type of value to interpolate into the format string.</typeparam>
  131. /// <typeparam name="T1">The type of value to interpolate into the format string.</typeparam>
  132. /// <typeparam name="T2">The type of value to interpolate into the format string.</typeparam>
  133. /// <param name="dest">The string to append to.</param>d
  134. /// <param name="format">A string to be interpolated and appended.</param>
  135. /// <param name="arg0">A FixedString*N*Bytes to interpolate into the format string.</param>
  136. /// <param name="arg1">A FixedString*N*Bytes to interpolate into the format string.</param>
  137. /// <param name="arg2">A FixedString*N*Bytes to interpolate into the format string.</param>
  138. [BurstCompatible(GenericTypeArguments = new[] { typeof(FixedString128Bytes /*T*/), typeof(FixedString128Bytes /*U*/), typeof(FixedString128Bytes /*T0*/), typeof(FixedString128Bytes /*T1*/), typeof(FixedString128Bytes /*T2*/) })]
  139. public static unsafe void AppendFormat<T, U, T0, T1, T2>(ref this T dest, in U format, in T0 arg0, in T1 arg1, in T2 arg2)
  140. where T : struct, INativeList<byte>, IUTF8Bytes
  141. where U : struct, INativeList<byte>, IUTF8Bytes
  142. where T0 : struct, INativeList<byte>, IUTF8Bytes
  143. where T1 : struct, INativeList<byte>, IUTF8Bytes
  144. where T2 : struct, INativeList<byte>, IUTF8Bytes
  145. {
  146. ref var formatRef = ref UnsafeUtilityExtensions.AsRef(in format);
  147. int formatLength = formatRef.Length;
  148. byte* formatBytes = formatRef.GetUnsafePtr();
  149. for (var i = 0; i < formatLength; ++i)
  150. {
  151. if (formatBytes[i] == (byte)'{')
  152. {
  153. if (formatLength - i >= 3 && formatBytes[i + 1] != (byte)'{')
  154. {
  155. var index = formatBytes[i + 1] - (byte)'0';
  156. switch (index)
  157. {
  158. case 0: dest.Append(in arg0); i+=2; break;
  159. case 1: dest.Append(in arg1); i+=2; break;
  160. case 2: dest.Append(in arg2); i+=2; break;
  161. default:
  162. dest.AppendRawByte(formatBytes[i]);
  163. break;
  164. }
  165. }
  166. }
  167. else
  168. dest.AppendRawByte(formatBytes[i]);
  169. }
  170. }
  171. /// <summary>
  172. /// Interpolates strings into a format string and appends the result to this string.
  173. /// </summary>
  174. /// <remarks>
  175. /// Similar to `StringBuilder.AppendFormat` but with significant limitations:
  176. /// - Only supports FixedString*N*Bytes arguments. To use other string types, convert them to FixedString*N*Bytes first.
  177. /// - Only supports numeric format placeholders of the form `{0}` .. `{N}`.
  178. /// - No format modifiers (*e.g.* `{0:x}`) are supported.
  179. ///
  180. /// The overloads of this method take up to ten strings to interpolate into the format string.
  181. /// </remarks>
  182. /// <typeparam name="T">A FixedString*N*Bytes type.</typeparam>
  183. /// <typeparam name="U">A FixedString*N*Bytes type.</typeparam>
  184. /// <typeparam name="T0">The type of value to interpolate into the format string.</typeparam>
  185. /// <typeparam name="T1">The type of value to interpolate into the format string.</typeparam>
  186. /// <typeparam name="T2">The type of value to interpolate into the format string.</typeparam>
  187. /// <typeparam name="T3">The type of value to interpolate into the format string.</typeparam>
  188. /// <param name="dest">The string to append to.</param>d
  189. /// <param name="format">A string to be interpolated and appended.</param>
  190. /// <param name="arg0">A FixedString*N*Bytes to interpolate into the format string.</param>
  191. /// <param name="arg1">A FixedString*N*Bytes to interpolate into the format string.</param>
  192. /// <param name="arg2">A FixedString*N*Bytes to interpolate into the format string.</param>
  193. /// <param name="arg3">A FixedString*N*Bytes to interpolate into the format string.</param>
  194. [BurstCompatible(GenericTypeArguments = new[] { typeof(FixedString128Bytes /*T*/), typeof(FixedString128Bytes /*U*/), typeof(FixedString128Bytes /*T0*/), typeof(FixedString128Bytes /*T1*/), typeof(FixedString128Bytes /*T2*/), typeof(FixedString128Bytes /*T3*/) })]
  195. public static unsafe void AppendFormat<T, U, T0, T1, T2, T3>(ref this T dest, in U format, in T0 arg0, in T1 arg1, in T2 arg2, in T3 arg3)
  196. where T : struct, INativeList<byte>, IUTF8Bytes
  197. where U : struct, INativeList<byte>, IUTF8Bytes
  198. where T0 : struct, INativeList<byte>, IUTF8Bytes
  199. where T1 : struct, INativeList<byte>, IUTF8Bytes
  200. where T2 : struct, INativeList<byte>, IUTF8Bytes
  201. where T3 : struct, INativeList<byte>, IUTF8Bytes
  202. {
  203. ref var formatRef = ref UnsafeUtilityExtensions.AsRef(in format);
  204. int formatLength = formatRef.Length;
  205. byte* formatBytes = formatRef.GetUnsafePtr();
  206. for (var i = 0; i < formatLength; ++i)
  207. {
  208. if (formatBytes[i] == (byte)'{')
  209. {
  210. if (formatLength - i >= 3 && formatBytes[i + 1] != (byte)'{')
  211. {
  212. var index = formatBytes[i + 1] - (byte)'0';
  213. switch (index)
  214. {
  215. case 0: dest.Append(in arg0); i+=2; break;
  216. case 1: dest.Append(in arg1); i+=2; break;
  217. case 2: dest.Append(in arg2); i+=2; break;
  218. case 3: dest.Append(in arg3); i+=2; break;
  219. default:
  220. dest.AppendRawByte(formatBytes[i]);
  221. break;
  222. }
  223. }
  224. }
  225. else
  226. dest.AppendRawByte(formatBytes[i]);
  227. }
  228. }
  229. /// <summary>
  230. /// Interpolates strings into a format string and appends the result to this string.
  231. /// </summary>
  232. /// <remarks>
  233. /// Similar to `StringBuilder.AppendFormat` but with significant limitations:
  234. /// - Only supports FixedString*N*Bytes arguments. To use other string types, convert them to FixedString*N*Bytes first.
  235. /// - Only supports numeric format placeholders of the form `{0}` .. `{N}`.
  236. /// - No format modifiers (*e.g.* `{0:x}`) are supported.
  237. ///
  238. /// The overloads of this method take up to ten strings to interpolate into the format string.
  239. /// </remarks>
  240. /// <typeparam name="T">A FixedString*N*Bytes type.</typeparam>
  241. /// <typeparam name="U">A FixedString*N*Bytes type.</typeparam>
  242. /// <typeparam name="T0">The type of value to interpolate into the format string.</typeparam>
  243. /// <typeparam name="T1">The type of value to interpolate into the format string.</typeparam>
  244. /// <typeparam name="T2">The type of value to interpolate into the format string.</typeparam>
  245. /// <typeparam name="T3">The type of value to interpolate into the format string.</typeparam>
  246. /// <typeparam name="T4">The type of value to interpolate into the format string.</typeparam>
  247. /// <param name="dest">The string to append to.</param>d
  248. /// <param name="format">A string to be interpolated and appended.</param>
  249. /// <param name="arg0">A FixedString*N*Bytes to interpolate into the format string.</param>
  250. /// <param name="arg1">A FixedString*N*Bytes to interpolate into the format string.</param>
  251. /// <param name="arg2">A FixedString*N*Bytes to interpolate into the format string.</param>
  252. /// <param name="arg3">A FixedString*N*Bytes to interpolate into the format string.</param>
  253. /// <param name="arg4">A FixedString*N*Bytes to interpolate into the format string.</param>
  254. [BurstCompatible(GenericTypeArguments = new[] { typeof(FixedString128Bytes /*T*/), typeof(FixedString128Bytes /*U*/), typeof(FixedString128Bytes /*T0*/), typeof(FixedString128Bytes /*T1*/), typeof(FixedString128Bytes /*T2*/), typeof(FixedString128Bytes /*T3*/), typeof(FixedString128Bytes /*T4*/) })]
  255. public static unsafe void AppendFormat<T, U, T0, T1, T2, T3, T4>(ref this T dest, in U format, in T0 arg0, in T1 arg1, in T2 arg2, in T3 arg3, in T4 arg4)
  256. where T : struct, INativeList<byte>, IUTF8Bytes
  257. where U : struct, INativeList<byte>, IUTF8Bytes
  258. where T0 : struct, INativeList<byte>, IUTF8Bytes
  259. where T1 : struct, INativeList<byte>, IUTF8Bytes
  260. where T2 : struct, INativeList<byte>, IUTF8Bytes
  261. where T3 : struct, INativeList<byte>, IUTF8Bytes
  262. where T4 : struct, INativeList<byte>, IUTF8Bytes
  263. {
  264. ref var formatRef = ref UnsafeUtilityExtensions.AsRef(in format);
  265. int formatLength = formatRef.Length;
  266. byte* formatBytes = formatRef.GetUnsafePtr();
  267. for (var i = 0; i < formatLength; ++i)
  268. {
  269. if (formatBytes[i] == (byte)'{')
  270. {
  271. if (formatLength - i >= 3 && formatBytes[i + 1] != (byte)'{')
  272. {
  273. var index = formatBytes[i + 1] - (byte)'0';
  274. switch (index)
  275. {
  276. case 0: dest.Append(in arg0); i+=2; break;
  277. case 1: dest.Append(in arg1); i+=2; break;
  278. case 2: dest.Append(in arg2); i+=2; break;
  279. case 3: dest.Append(in arg3); i+=2; break;
  280. case 4: dest.Append(in arg4); i+=2; break;
  281. default:
  282. dest.AppendRawByte(formatBytes[i]);
  283. break;
  284. }
  285. }
  286. }
  287. else
  288. dest.AppendRawByte(formatBytes[i]);
  289. }
  290. }
  291. /// <summary>
  292. /// Interpolates strings into a format string and appends the result to this string.
  293. /// </summary>
  294. /// <remarks>
  295. /// Similar to `StringBuilder.AppendFormat` but with significant limitations:
  296. /// - Only supports FixedString*N*Bytes arguments. To use other string types, convert them to FixedString*N*Bytes first.
  297. /// - Only supports numeric format placeholders of the form `{0}` .. `{N}`.
  298. /// - No format modifiers (*e.g.* `{0:x}`) are supported.
  299. ///
  300. /// The overloads of this method take up to ten strings to interpolate into the format string.
  301. /// </remarks>
  302. /// <typeparam name="T">A FixedString*N*Bytes type.</typeparam>
  303. /// <typeparam name="U">A FixedString*N*Bytes type.</typeparam>
  304. /// <typeparam name="T0">The type of value to interpolate into the format string.</typeparam>
  305. /// <typeparam name="T1">The type of value to interpolate into the format string.</typeparam>
  306. /// <typeparam name="T2">The type of value to interpolate into the format string.</typeparam>
  307. /// <typeparam name="T3">The type of value to interpolate into the format string.</typeparam>
  308. /// <typeparam name="T4">The type of value to interpolate into the format string.</typeparam>
  309. /// <typeparam name="T5">The type of value to interpolate into the format string.</typeparam>
  310. /// <param name="dest">The string to append to.</param>d
  311. /// <param name="format">A string to be interpolated and appended.</param>
  312. /// <param name="arg0">A FixedString*N*Bytes to interpolate into the format string.</param>
  313. /// <param name="arg1">A FixedString*N*Bytes to interpolate into the format string.</param>
  314. /// <param name="arg2">A FixedString*N*Bytes to interpolate into the format string.</param>
  315. /// <param name="arg3">A FixedString*N*Bytes to interpolate into the format string.</param>
  316. /// <param name="arg4">A FixedString*N*Bytes to interpolate into the format string.</param>
  317. /// <param name="arg5">A FixedString*N*Bytes to interpolate into the format string.</param>
  318. [BurstCompatible(GenericTypeArguments = new[] { typeof(FixedString128Bytes /*T*/), typeof(FixedString128Bytes /*U*/), typeof(FixedString128Bytes /*T0*/), typeof(FixedString128Bytes /*T1*/), typeof(FixedString128Bytes /*T2*/), typeof(FixedString128Bytes /*T3*/), typeof(FixedString128Bytes /*T4*/), typeof(FixedString128Bytes /*T5*/) })]
  319. public static unsafe void AppendFormat<T, U, T0, T1, T2, T3, T4, T5>(ref this T dest, in U format, in T0 arg0, in T1 arg1, in T2 arg2, in T3 arg3, in T4 arg4, in T5 arg5)
  320. where T : struct, INativeList<byte>, IUTF8Bytes
  321. where U : struct, INativeList<byte>, IUTF8Bytes
  322. where T0 : struct, INativeList<byte>, IUTF8Bytes
  323. where T1 : struct, INativeList<byte>, IUTF8Bytes
  324. where T2 : struct, INativeList<byte>, IUTF8Bytes
  325. where T3 : struct, INativeList<byte>, IUTF8Bytes
  326. where T4 : struct, INativeList<byte>, IUTF8Bytes
  327. where T5 : struct, INativeList<byte>, IUTF8Bytes
  328. {
  329. ref var formatRef = ref UnsafeUtilityExtensions.AsRef(in format);
  330. int formatLength = formatRef.Length;
  331. byte* formatBytes = formatRef.GetUnsafePtr();
  332. for (var i = 0; i < formatLength; ++i)
  333. {
  334. if (formatBytes[i] == (byte)'{')
  335. {
  336. if (formatLength - i >= 3 && formatBytes[i + 1] != (byte)'{')
  337. {
  338. var index = formatBytes[i + 1] - (byte)'0';
  339. switch (index)
  340. {
  341. case 0: dest.Append(in arg0); i+=2; break;
  342. case 1: dest.Append(in arg1); i+=2; break;
  343. case 2: dest.Append(in arg2); i+=2; break;
  344. case 3: dest.Append(in arg3); i+=2; break;
  345. case 4: dest.Append(in arg4); i+=2; break;
  346. case 5: dest.Append(in arg5); i+=2; break;
  347. default:
  348. dest.AppendRawByte(formatBytes[i]);
  349. break;
  350. }
  351. }
  352. }
  353. else
  354. dest.AppendRawByte(formatBytes[i]);
  355. }
  356. }
  357. /// <summary>
  358. /// Interpolates strings into a format string and appends the result to this string.
  359. /// </summary>
  360. /// <remarks>
  361. /// Similar to `StringBuilder.AppendFormat` but with significant limitations:
  362. /// - Only supports FixedString*N*Bytes arguments. To use other string types, convert them to FixedString*N*Bytes first.
  363. /// - Only supports numeric format placeholders of the form `{0}` .. `{N}`.
  364. /// - No format modifiers (*e.g.* `{0:x}`) are supported.
  365. ///
  366. /// The overloads of this method take up to ten strings to interpolate into the format string.
  367. /// </remarks>
  368. /// <typeparam name="T">A FixedString*N*Bytes type.</typeparam>
  369. /// <typeparam name="U">A FixedString*N*Bytes type.</typeparam>
  370. /// <typeparam name="T0">The type of value to interpolate into the format string.</typeparam>
  371. /// <typeparam name="T1">The type of value to interpolate into the format string.</typeparam>
  372. /// <typeparam name="T2">The type of value to interpolate into the format string.</typeparam>
  373. /// <typeparam name="T3">The type of value to interpolate into the format string.</typeparam>
  374. /// <typeparam name="T4">The type of value to interpolate into the format string.</typeparam>
  375. /// <typeparam name="T5">The type of value to interpolate into the format string.</typeparam>
  376. /// <typeparam name="T6">The type of value to interpolate into the format string.</typeparam>
  377. /// <param name="dest">The string to append to.</param>d
  378. /// <param name="format">A string to be interpolated and appended.</param>
  379. /// <param name="arg0">A FixedString*N*Bytes to interpolate into the format string.</param>
  380. /// <param name="arg1">A FixedString*N*Bytes to interpolate into the format string.</param>
  381. /// <param name="arg2">A FixedString*N*Bytes to interpolate into the format string.</param>
  382. /// <param name="arg3">A FixedString*N*Bytes to interpolate into the format string.</param>
  383. /// <param name="arg4">A FixedString*N*Bytes to interpolate into the format string.</param>
  384. /// <param name="arg5">A FixedString*N*Bytes to interpolate into the format string.</param>
  385. /// <param name="arg6">A FixedString*N*Bytes to interpolate into the format string.</param>
  386. [BurstCompatible(GenericTypeArguments = new[] { typeof(FixedString128Bytes /*T*/), typeof(FixedString128Bytes /*U*/), typeof(FixedString128Bytes /*T0*/), typeof(FixedString128Bytes /*T1*/), typeof(FixedString128Bytes /*T2*/), typeof(FixedString128Bytes /*T3*/), typeof(FixedString128Bytes /*T4*/), typeof(FixedString128Bytes /*T5*/), typeof(FixedString128Bytes /*T6*/) })]
  387. public static unsafe void AppendFormat<T, U, T0, T1, T2, T3, T4, T5, T6>(ref this T dest, in U format, in T0 arg0, in T1 arg1, in T2 arg2, in T3 arg3, in T4 arg4, in T5 arg5, in T6 arg6)
  388. where T : struct, INativeList<byte>, IUTF8Bytes
  389. where U : struct, INativeList<byte>, IUTF8Bytes
  390. where T0 : struct, INativeList<byte>, IUTF8Bytes
  391. where T1 : struct, INativeList<byte>, IUTF8Bytes
  392. where T2 : struct, INativeList<byte>, IUTF8Bytes
  393. where T3 : struct, INativeList<byte>, IUTF8Bytes
  394. where T4 : struct, INativeList<byte>, IUTF8Bytes
  395. where T5 : struct, INativeList<byte>, IUTF8Bytes
  396. where T6 : struct, INativeList<byte>, IUTF8Bytes
  397. {
  398. ref var formatRef = ref UnsafeUtilityExtensions.AsRef(in format);
  399. int formatLength = formatRef.Length;
  400. byte* formatBytes = formatRef.GetUnsafePtr();
  401. for (var i = 0; i < formatLength; ++i)
  402. {
  403. if (formatBytes[i] == (byte)'{')
  404. {
  405. if (formatLength - i >= 3 && formatBytes[i + 1] != (byte)'{')
  406. {
  407. var index = formatBytes[i + 1] - (byte)'0';
  408. switch (index)
  409. {
  410. case 0: dest.Append(in arg0); i+=2; break;
  411. case 1: dest.Append(in arg1); i+=2; break;
  412. case 2: dest.Append(in arg2); i+=2; break;
  413. case 3: dest.Append(in arg3); i+=2; break;
  414. case 4: dest.Append(in arg4); i+=2; break;
  415. case 5: dest.Append(in arg5); i+=2; break;
  416. case 6: dest.Append(in arg6); i+=2; break;
  417. default:
  418. dest.AppendRawByte(formatBytes[i]);
  419. break;
  420. }
  421. }
  422. }
  423. else
  424. dest.AppendRawByte(formatBytes[i]);
  425. }
  426. }
  427. /// <summary>
  428. /// Interpolates strings into a format string and appends the result to this string.
  429. /// </summary>
  430. /// <remarks>
  431. /// Similar to `StringBuilder.AppendFormat` but with significant limitations:
  432. /// - Only supports FixedString*N*Bytes arguments. To use other string types, convert them to FixedString*N*Bytes first.
  433. /// - Only supports numeric format placeholders of the form `{0}` .. `{N}`.
  434. /// - No format modifiers (*e.g.* `{0:x}`) are supported.
  435. ///
  436. /// The overloads of this method take up to ten strings to interpolate into the format string.
  437. /// </remarks>
  438. /// <typeparam name="T">A FixedString*N*Bytes type.</typeparam>
  439. /// <typeparam name="U">A FixedString*N*Bytes type.</typeparam>
  440. /// <typeparam name="T0">The type of value to interpolate into the format string.</typeparam>
  441. /// <typeparam name="T1">The type of value to interpolate into the format string.</typeparam>
  442. /// <typeparam name="T2">The type of value to interpolate into the format string.</typeparam>
  443. /// <typeparam name="T3">The type of value to interpolate into the format string.</typeparam>
  444. /// <typeparam name="T4">The type of value to interpolate into the format string.</typeparam>
  445. /// <typeparam name="T5">The type of value to interpolate into the format string.</typeparam>
  446. /// <typeparam name="T6">The type of value to interpolate into the format string.</typeparam>
  447. /// <typeparam name="T7">The type of value to interpolate into the format string.</typeparam>
  448. /// <param name="dest">The string to append to.</param>d
  449. /// <param name="format">A string to be interpolated and appended.</param>
  450. /// <param name="arg0">A FixedString*N*Bytes to interpolate into the format string.</param>
  451. /// <param name="arg1">A FixedString*N*Bytes to interpolate into the format string.</param>
  452. /// <param name="arg2">A FixedString*N*Bytes to interpolate into the format string.</param>
  453. /// <param name="arg3">A FixedString*N*Bytes to interpolate into the format string.</param>
  454. /// <param name="arg4">A FixedString*N*Bytes to interpolate into the format string.</param>
  455. /// <param name="arg5">A FixedString*N*Bytes to interpolate into the format string.</param>
  456. /// <param name="arg6">A FixedString*N*Bytes to interpolate into the format string.</param>
  457. /// <param name="arg7">A FixedString*N*Bytes to interpolate into the format string.</param>
  458. [BurstCompatible(GenericTypeArguments = new[] { typeof(FixedString128Bytes /*T*/), typeof(FixedString128Bytes /*U*/), typeof(FixedString128Bytes /*T0*/), typeof(FixedString128Bytes /*T1*/), typeof(FixedString128Bytes /*T2*/), typeof(FixedString128Bytes /*T3*/), typeof(FixedString128Bytes /*T4*/), typeof(FixedString128Bytes /*T5*/), typeof(FixedString128Bytes /*T6*/), typeof(FixedString128Bytes /*T7*/) })]
  459. public static unsafe void AppendFormat<T, U, T0, T1, T2, T3, T4, T5, T6, T7>(ref this T dest, in U format, in T0 arg0, in T1 arg1, in T2 arg2, in T3 arg3, in T4 arg4, in T5 arg5, in T6 arg6, in T7 arg7)
  460. where T : struct, INativeList<byte>, IUTF8Bytes
  461. where U : struct, INativeList<byte>, IUTF8Bytes
  462. where T0 : struct, INativeList<byte>, IUTF8Bytes
  463. where T1 : struct, INativeList<byte>, IUTF8Bytes
  464. where T2 : struct, INativeList<byte>, IUTF8Bytes
  465. where T3 : struct, INativeList<byte>, IUTF8Bytes
  466. where T4 : struct, INativeList<byte>, IUTF8Bytes
  467. where T5 : struct, INativeList<byte>, IUTF8Bytes
  468. where T6 : struct, INativeList<byte>, IUTF8Bytes
  469. where T7 : struct, INativeList<byte>, IUTF8Bytes
  470. {
  471. ref var formatRef = ref UnsafeUtilityExtensions.AsRef(in format);
  472. int formatLength = formatRef.Length;
  473. byte* formatBytes = formatRef.GetUnsafePtr();
  474. for (var i = 0; i < formatLength; ++i)
  475. {
  476. if (formatBytes[i] == (byte)'{')
  477. {
  478. if (formatLength - i >= 3 && formatBytes[i + 1] != (byte)'{')
  479. {
  480. var index = formatBytes[i + 1] - (byte)'0';
  481. switch (index)
  482. {
  483. case 0: dest.Append(in arg0); i+=2; break;
  484. case 1: dest.Append(in arg1); i+=2; break;
  485. case 2: dest.Append(in arg2); i+=2; break;
  486. case 3: dest.Append(in arg3); i+=2; break;
  487. case 4: dest.Append(in arg4); i+=2; break;
  488. case 5: dest.Append(in arg5); i+=2; break;
  489. case 6: dest.Append(in arg6); i+=2; break;
  490. case 7: dest.Append(in arg7); i+=2; break;
  491. default:
  492. dest.AppendRawByte(formatBytes[i]);
  493. break;
  494. }
  495. }
  496. }
  497. else
  498. dest.AppendRawByte(formatBytes[i]);
  499. }
  500. }
  501. /// <summary>
  502. /// Interpolates strings into a format string and appends the result to this string.
  503. /// </summary>
  504. /// <remarks>
  505. /// Similar to `StringBuilder.AppendFormat` but with significant limitations:
  506. /// - Only supports FixedString*N*Bytes arguments. To use other string types, convert them to FixedString*N*Bytes first.
  507. /// - Only supports numeric format placeholders of the form `{0}` .. `{N}`.
  508. /// - No format modifiers (*e.g.* `{0:x}`) are supported.
  509. ///
  510. /// The overloads of this method take up to ten strings to interpolate into the format string.
  511. /// </remarks>
  512. /// <typeparam name="T">A FixedString*N*Bytes type.</typeparam>
  513. /// <typeparam name="U">A FixedString*N*Bytes type.</typeparam>
  514. /// <typeparam name="T0">The type of value to interpolate into the format string.</typeparam>
  515. /// <typeparam name="T1">The type of value to interpolate into the format string.</typeparam>
  516. /// <typeparam name="T2">The type of value to interpolate into the format string.</typeparam>
  517. /// <typeparam name="T3">The type of value to interpolate into the format string.</typeparam>
  518. /// <typeparam name="T4">The type of value to interpolate into the format string.</typeparam>
  519. /// <typeparam name="T5">The type of value to interpolate into the format string.</typeparam>
  520. /// <typeparam name="T6">The type of value to interpolate into the format string.</typeparam>
  521. /// <typeparam name="T7">The type of value to interpolate into the format string.</typeparam>
  522. /// <typeparam name="T8">The type of value to interpolate into the format string.</typeparam>
  523. /// <param name="dest">The string to append to.</param>d
  524. /// <param name="format">A string to be interpolated and appended.</param>
  525. /// <param name="arg0">A FixedString*N*Bytes to interpolate into the format string.</param>
  526. /// <param name="arg1">A FixedString*N*Bytes to interpolate into the format string.</param>
  527. /// <param name="arg2">A FixedString*N*Bytes to interpolate into the format string.</param>
  528. /// <param name="arg3">A FixedString*N*Bytes to interpolate into the format string.</param>
  529. /// <param name="arg4">A FixedString*N*Bytes to interpolate into the format string.</param>
  530. /// <param name="arg5">A FixedString*N*Bytes to interpolate into the format string.</param>
  531. /// <param name="arg6">A FixedString*N*Bytes to interpolate into the format string.</param>
  532. /// <param name="arg7">A FixedString*N*Bytes to interpolate into the format string.</param>
  533. /// <param name="arg8">A FixedString*N*Bytes to interpolate into the format string.</param>
  534. [BurstCompatible(GenericTypeArguments = new[] { typeof(FixedString128Bytes /*T*/), typeof(FixedString128Bytes /*U*/), typeof(FixedString128Bytes /*T0*/), typeof(FixedString128Bytes /*T1*/), typeof(FixedString128Bytes /*T2*/), typeof(FixedString128Bytes /*T3*/), typeof(FixedString128Bytes /*T4*/), typeof(FixedString128Bytes /*T5*/), typeof(FixedString128Bytes /*T6*/), typeof(FixedString128Bytes /*T7*/), typeof(FixedString128Bytes /*T8*/) })]
  535. public static unsafe void AppendFormat<T, U, T0, T1, T2, T3, T4, T5, T6, T7, T8>(ref this T dest, in U format, in T0 arg0, in T1 arg1, in T2 arg2, in T3 arg3, in T4 arg4, in T5 arg5, in T6 arg6, in T7 arg7, in T8 arg8)
  536. where T : struct, INativeList<byte>, IUTF8Bytes
  537. where U : struct, INativeList<byte>, IUTF8Bytes
  538. where T0 : struct, INativeList<byte>, IUTF8Bytes
  539. where T1 : struct, INativeList<byte>, IUTF8Bytes
  540. where T2 : struct, INativeList<byte>, IUTF8Bytes
  541. where T3 : struct, INativeList<byte>, IUTF8Bytes
  542. where T4 : struct, INativeList<byte>, IUTF8Bytes
  543. where T5 : struct, INativeList<byte>, IUTF8Bytes
  544. where T6 : struct, INativeList<byte>, IUTF8Bytes
  545. where T7 : struct, INativeList<byte>, IUTF8Bytes
  546. where T8 : struct, INativeList<byte>, IUTF8Bytes
  547. {
  548. ref var formatRef = ref UnsafeUtilityExtensions.AsRef(in format);
  549. int formatLength = formatRef.Length;
  550. byte* formatBytes = formatRef.GetUnsafePtr();
  551. for (var i = 0; i < formatLength; ++i)
  552. {
  553. if (formatBytes[i] == (byte)'{')
  554. {
  555. if (formatLength - i >= 3 && formatBytes[i + 1] != (byte)'{')
  556. {
  557. var index = formatBytes[i + 1] - (byte)'0';
  558. switch (index)
  559. {
  560. case 0: dest.Append(in arg0); i+=2; break;
  561. case 1: dest.Append(in arg1); i+=2; break;
  562. case 2: dest.Append(in arg2); i+=2; break;
  563. case 3: dest.Append(in arg3); i+=2; break;
  564. case 4: dest.Append(in arg4); i+=2; break;
  565. case 5: dest.Append(in arg5); i+=2; break;
  566. case 6: dest.Append(in arg6); i+=2; break;
  567. case 7: dest.Append(in arg7); i+=2; break;
  568. case 8: dest.Append(in arg8); i+=2; break;
  569. default:
  570. dest.AppendRawByte(formatBytes[i]);
  571. break;
  572. }
  573. }
  574. }
  575. else
  576. dest.AppendRawByte(formatBytes[i]);
  577. }
  578. }
  579. /// <summary>
  580. /// Interpolates strings into a format string and appends the result to this string.
  581. /// </summary>
  582. /// <remarks>
  583. /// Similar to `StringBuilder.AppendFormat` but with significant limitations:
  584. /// - Only supports FixedString*N*Bytes arguments. To use other string types, convert them to FixedString*N*Bytes first.
  585. /// - Only supports numeric format placeholders of the form `{0}` .. `{N}`.
  586. /// - No format modifiers (*e.g.* `{0:x}`) are supported.
  587. ///
  588. /// The overloads of this method take up to ten strings to interpolate into the format string.
  589. /// </remarks>
  590. /// <typeparam name="T">A FixedString*N*Bytes type.</typeparam>
  591. /// <typeparam name="U">A FixedString*N*Bytes type.</typeparam>
  592. /// <typeparam name="T0">The type of value to interpolate into the format string.</typeparam>
  593. /// <typeparam name="T1">The type of value to interpolate into the format string.</typeparam>
  594. /// <typeparam name="T2">The type of value to interpolate into the format string.</typeparam>
  595. /// <typeparam name="T3">The type of value to interpolate into the format string.</typeparam>
  596. /// <typeparam name="T4">The type of value to interpolate into the format string.</typeparam>
  597. /// <typeparam name="T5">The type of value to interpolate into the format string.</typeparam>
  598. /// <typeparam name="T6">The type of value to interpolate into the format string.</typeparam>
  599. /// <typeparam name="T7">The type of value to interpolate into the format string.</typeparam>
  600. /// <typeparam name="T8">The type of value to interpolate into the format string.</typeparam>
  601. /// <typeparam name="T9">The type of value to interpolate into the format string.</typeparam>
  602. /// <param name="dest">The string to append to.</param>d
  603. /// <param name="format">A string to be interpolated and appended.</param>
  604. /// <param name="arg0">A FixedString*N*Bytes to interpolate into the format string.</param>
  605. /// <param name="arg1">A FixedString*N*Bytes to interpolate into the format string.</param>
  606. /// <param name="arg2">A FixedString*N*Bytes to interpolate into the format string.</param>
  607. /// <param name="arg3">A FixedString*N*Bytes to interpolate into the format string.</param>
  608. /// <param name="arg4">A FixedString*N*Bytes to interpolate into the format string.</param>
  609. /// <param name="arg5">A FixedString*N*Bytes to interpolate into the format string.</param>
  610. /// <param name="arg6">A FixedString*N*Bytes to interpolate into the format string.</param>
  611. /// <param name="arg7">A FixedString*N*Bytes to interpolate into the format string.</param>
  612. /// <param name="arg8">A FixedString*N*Bytes to interpolate into the format string.</param>
  613. /// <param name="arg9">A FixedString*N*Bytes to interpolate into the format string.</param>
  614. [BurstCompatible(GenericTypeArguments = new[] { typeof(FixedString128Bytes /*T*/), typeof(FixedString128Bytes /*U*/), typeof(FixedString128Bytes /*T0*/), typeof(FixedString128Bytes /*T1*/), typeof(FixedString128Bytes /*T2*/), typeof(FixedString128Bytes /*T3*/), typeof(FixedString128Bytes /*T4*/), typeof(FixedString128Bytes /*T5*/), typeof(FixedString128Bytes /*T6*/), typeof(FixedString128Bytes /*T7*/), typeof(FixedString128Bytes /*T8*/), typeof(FixedString128Bytes /*T9*/) })]
  615. public static unsafe void AppendFormat<T, U, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>(ref this T dest, in U format, in T0 arg0, in T1 arg1, in T2 arg2, in T3 arg3, in T4 arg4, in T5 arg5, in T6 arg6, in T7 arg7, in T8 arg8, in T9 arg9)
  616. where T : struct, INativeList<byte>, IUTF8Bytes
  617. where U : struct, INativeList<byte>, IUTF8Bytes
  618. where T0 : struct, INativeList<byte>, IUTF8Bytes
  619. where T1 : struct, INativeList<byte>, IUTF8Bytes
  620. where T2 : struct, INativeList<byte>, IUTF8Bytes
  621. where T3 : struct, INativeList<byte>, IUTF8Bytes
  622. where T4 : struct, INativeList<byte>, IUTF8Bytes
  623. where T5 : struct, INativeList<byte>, IUTF8Bytes
  624. where T6 : struct, INativeList<byte>, IUTF8Bytes
  625. where T7 : struct, INativeList<byte>, IUTF8Bytes
  626. where T8 : struct, INativeList<byte>, IUTF8Bytes
  627. where T9 : struct, INativeList<byte>, IUTF8Bytes
  628. {
  629. ref var formatRef = ref UnsafeUtilityExtensions.AsRef(in format);
  630. int formatLength = formatRef.Length;
  631. byte* formatBytes = formatRef.GetUnsafePtr();
  632. for (var i = 0; i < formatLength; ++i)
  633. {
  634. if (formatBytes[i] == (byte)'{')
  635. {
  636. if (formatLength - i >= 3 && formatBytes[i + 1] != (byte)'{')
  637. {
  638. var index = formatBytes[i + 1] - (byte)'0';
  639. switch (index)
  640. {
  641. case 0: dest.Append(in arg0); i+=2; break;
  642. case 1: dest.Append(in arg1); i+=2; break;
  643. case 2: dest.Append(in arg2); i+=2; break;
  644. case 3: dest.Append(in arg3); i+=2; break;
  645. case 4: dest.Append(in arg4); i+=2; break;
  646. case 5: dest.Append(in arg5); i+=2; break;
  647. case 6: dest.Append(in arg6); i+=2; break;
  648. case 7: dest.Append(in arg7); i+=2; break;
  649. case 8: dest.Append(in arg8); i+=2; break;
  650. case 9: dest.Append(in arg9); i+=2; break;
  651. default:
  652. dest.AppendRawByte(formatBytes[i]);
  653. break;
  654. }
  655. }
  656. }
  657. else
  658. dest.AppendRawByte(formatBytes[i]);
  659. }
  660. }
  661. }
  662. }