using System;
namespace KcpSharp
{
///
/// The options to use when renting buffers from the pool.
///
public readonly struct KcpBufferPoolRentOptions : IEquatable
{
private readonly int _size;
private readonly bool _isOutbound;
///
/// The minimum size of the buffer.
///
public int Size => _size;
///
/// True if the buffer may be passed to the outside of KcpSharp. False if the buffer is only used internally in KcpSharp.
///
public bool IsOutbound => _isOutbound;
///
/// Create a with the specified parameters.
///
/// The minimum size of the buffer.
/// True if the buffer may be passed to the outside of KcpSharp. False if the buffer is only used internally in KcpSharp.
public KcpBufferPoolRentOptions(int size, bool isOutbound)
{
_size = size;
_isOutbound = isOutbound;
}
///
public bool Equals(KcpBufferPoolRentOptions other) => _size == other._size && _isOutbound == other.IsOutbound;
///
public override bool Equals(object? obj) => obj is KcpBufferPoolRentOptions other && Equals(other);
///
public override int GetHashCode() => HashCode.Combine(_size, _isOutbound);
}
}