mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-26 04:58:24 +01:00
SOURCE DUMP v1
This commit is contained in:
parent
bd62d51ec9
commit
fb20299e9d
2 changed files with 768360 additions and 0 deletions
27
brutal.core/Brutal.Core/Interfaces/INullable.cs
Normal file
27
brutal.core/Brutal.Core/Interfaces/INullable.cs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
namespace Brutal;
|
||||
|
||||
/// <summary>
|
||||
/// Interface for a type that can be null
|
||||
/// </summary>
|
||||
public interface INullable
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns true if the instance is null
|
||||
/// </summary>
|
||||
public bool IsNull();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extensions for INullable
|
||||
/// </summary>
|
||||
public static class NullableExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns true if the instance is not null
|
||||
/// </summary>
|
||||
public static bool IsNotNull<T>(this T nullable)
|
||||
where T : INullable
|
||||
{
|
||||
return !nullable.IsNull();
|
||||
}
|
||||
}
|
||||
22
brutal.core/Brutal.Core/Interfaces/ISpanLike.cs
Normal file
22
brutal.core/Brutal.Core/Interfaces/ISpanLike.cs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
using Brutal.Pointers;
|
||||
|
||||
namespace Brutal;
|
||||
|
||||
public interface ISpanLike : INullable
|
||||
{
|
||||
public Ptr Ptr { get; }
|
||||
public ElementCount Length { get; }
|
||||
public ByteSize Stride { get; }
|
||||
public bool IsEmpty { get; }
|
||||
|
||||
public Span<T> AsSpan<T>()
|
||||
where T : unmanaged;
|
||||
}
|
||||
|
||||
public interface ISpanLike<T> : ISpanLike
|
||||
where T : unmanaged
|
||||
{
|
||||
public new Ptr<T> Ptr { get; }
|
||||
|
||||
public Span<T> AsSpan();
|
||||
}
|
||||
Loading…
Reference in a new issue