public static ReadOnlyMemory <T> TrimEnd <T>(this ReadOnlyMemory <T> memory, T trimElement) where T : IEquatable <T> => memory.Slice(0, ClampEnd(memory.Span, 0, trimElement));
public static ReadOnlyMemory <char> TrimEnd(this ReadOnlyMemory <char> memory) => memory.Slice(0, ClampEnd(memory.Span, 0));
public static ReadOnlyMemory <T> TrimStart <T>(this ReadOnlyMemory <T> memory, T trimElement) where T : IEquatable <T> => memory.Slice(ClampStart(memory.Span, trimElement));
public static ReadOnlyMemory <char> TrimStart(this ReadOnlyMemory <char> memory) => memory.Slice(ClampStart(memory.Span));