mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:47:35 +00:00
Everywhere: Use ReadonlySpan<T> instead of Span<T const>
This commit is contained in:
parent
1c92e6ee9d
commit
63b11030f0
102 changed files with 206 additions and 206 deletions
18
AK/Format.h
18
AK/Format.h
|
@ -264,13 +264,13 @@ private:
|
|||
|
||||
class TypeErasedFormatParams {
|
||||
public:
|
||||
Span<TypeErasedParameter const> parameters() const { return m_parameters; }
|
||||
ReadonlySpan<TypeErasedParameter> parameters() const { return m_parameters; }
|
||||
|
||||
void set_parameters(Span<TypeErasedParameter const> parameters) { m_parameters = parameters; }
|
||||
void set_parameters(ReadonlySpan<TypeErasedParameter> parameters) { m_parameters = parameters; }
|
||||
size_t take_next_index() { return m_next_index++; }
|
||||
|
||||
private:
|
||||
Span<TypeErasedParameter const> m_parameters;
|
||||
ReadonlySpan<TypeErasedParameter> m_parameters;
|
||||
size_t m_next_index { 0 };
|
||||
};
|
||||
|
||||
|
@ -359,14 +359,14 @@ struct Formatter<StringView> : StandardFormatter {
|
|||
|
||||
template<typename T>
|
||||
requires(HasFormatter<T>)
|
||||
struct Formatter<Span<T const>> : StandardFormatter {
|
||||
struct Formatter<ReadonlySpan<T>> : StandardFormatter {
|
||||
Formatter() = default;
|
||||
explicit Formatter(StandardFormatter formatter)
|
||||
: StandardFormatter(move(formatter))
|
||||
{
|
||||
}
|
||||
|
||||
ErrorOr<void> format(FormatBuilder& builder, Span<T const> value)
|
||||
ErrorOr<void> format(FormatBuilder& builder, ReadonlySpan<T> value)
|
||||
{
|
||||
if (m_mode == Mode::Pointer) {
|
||||
Formatter<FlatPtr> formatter { *this };
|
||||
|
@ -406,19 +406,19 @@ struct Formatter<Span<T const>> : StandardFormatter {
|
|||
|
||||
template<typename T>
|
||||
requires(HasFormatter<T>)
|
||||
struct Formatter<Span<T>> : Formatter<Span<T const>> {
|
||||
struct Formatter<Span<T>> : Formatter<ReadonlySpan<T>> {
|
||||
ErrorOr<void> format(FormatBuilder& builder, Span<T> value)
|
||||
{
|
||||
return Formatter<Span<T const>>::format(builder, value);
|
||||
return Formatter<ReadonlySpan<T>>::format(builder, value);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T, size_t inline_capacity>
|
||||
requires(HasFormatter<T>)
|
||||
struct Formatter<Vector<T, inline_capacity>> : Formatter<Span<T const>> {
|
||||
struct Formatter<Vector<T, inline_capacity>> : Formatter<ReadonlySpan<T>> {
|
||||
ErrorOr<void> format(FormatBuilder& builder, Vector<T, inline_capacity> const& value)
|
||||
{
|
||||
return Formatter<Span<T const>>::format(builder, value.span());
|
||||
return Formatter<ReadonlySpan<T>>::format(builder, value.span());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue