/// <summary> /// Converts an <see cref="AutoArray{T}"/> to an <see cref="AutoArraySegment{T}"/> /// </summary> /// <typeparam name="T">The type of array element</typeparam> /// <param name="array">The AutoArray to conver</param> /// <returns>An <see cref="AutoArraySegment{T}"/> representing the given array</returns> public static AutoArraySegment <T> From <T>(AutoArray <T> array) => new(new ArraySegment <T>(array.Array), array.Pool, array.WillClear);
/// <summary> /// Converts an <see cref="AutoArray{T}"/> into an AutoSequence /// </summary> /// <typeparam name="T">The type of array element</typeparam> /// <param name="array">The auto-rented array</param> /// <returns>An <see cref="AutoSequence{T}"/> providing automated disposal of the rented array</returns> /// <remarks>The original array must not be disposed of</remarks> public static AutoSequence <T> From <T>(AutoArray <T> array) => From(array.AsMemory(), array.Pool, array.WillClear);