// <auto-generated/>

#nullable disable

using System;
using System.Buffers.Text;

namespace Sample
{
    public partial class ModelSerializationExtensions
    {
        public static bool TryGetIndex(this global::System.ReadOnlySpan<byte> indexSlice, out int index, out int bytesConsumed)
        {
            index = -1;
            bytesConsumed = 0;

            if ((indexSlice.IsEmpty || (indexSlice[0] != '[')))
            {
                return false;
            }

            indexSlice = indexSlice.Slice(1);
            if ((indexSlice.IsEmpty || (indexSlice[0] == '-')))
            {
                return false;
            }

            int indexEnd = indexSlice.Slice(1).IndexOf(((byte)']'));
            if ((indexEnd < 0))
            {
                return false;
            }

            return global::System.Buffers.Text.Utf8Parser.TryParse(indexSlice.Slice(0, (indexEnd + 1)), out index, out bytesConsumed);
        }
    }
}
