namespace Brutal.Localization.FixedBuffers;
///
/// Interface for types that provide fixed writable buffers.
/// A fixed buffer must not be movable by the GC. For example a stackalloc'd buffer
/// or an array you have manually fixed.
///
/// The type of the elements stored in the buffer.
public interface IFixedBufferWriter
{
///
/// Tells the buffer writer that a number of elements have been written and the buffer writer
/// should advance its write position.
///
/// The number of elements that were written.
/// Thrown if count moves the write position past the end of the writer's maximum position, or
/// if count is negative.
public void Advance(ElementCount count);
///
/// Get a Span that can hold at least a specified number of elements.
///
/// One of either:
///
/// - LengthHint.NonZeroLengthHint: Request a non-empty Span of unspecified length.
/// - LengthHint.MaxLengthHint: Request the largest Span possible.
/// - Otherwise, a specific Span length to return.
///
/// A Span of the requested length or greater. Must never return an empty Span but can throw if the request cannot be fulfilled.
public Span GetSpan(ElementCount lengthHint);
///
/// Try to get a Span that can hold at least a specified number of elements, returning whether it succeeded or not.
///
///
/// When this method returns, if successful, contains a Span of the requested length or greater . If not successful will contain the largest Span that could have been returned.
/// true if a Span of the requested length or greater is returned. Otherwise, false.
public bool TryGetSpan(ElementCount lengthHint, out Span spanOut);
}