29 constexpr static auto operator()(T& self) ->
Span<byte> {
32 "as_writable_byte_span() customizations must return a Span<byte>");
45 requires(T
const& self) {
51 "as_byte_span() customizations must return a Span<byte const>");
66template<concepts::Allocator Alloc = platform::DefaultAllocator>
69template<concepts::Allocator Alloc = platform::DefaultAllocator>
72template<concepts::Allocator Alloc = platform::DefaultAllocator>
75template<concepts::Allocator Alloc>
81 template<concepts::Impl<meta::List<AsByteSpan>> T>
85 auto store =
DI_TRY(Store::create(di::forward<T>(value)));
91 template<concepts::Impl<meta::List<AsByteSpan>> T>
98 constexpr auto data() const ->
byte const* {
return m_data.data(); }
99 constexpr auto size() const ->
usize {
return m_data.size(); }
100 constexpr auto span() const ->
Span<
byte const> {
return m_data; }
101 constexpr auto empty() const ->
bool {
return m_data.empty(); }
103 constexpr auto store() const& ->
Store const& {
return m_store; }
134template<concepts::Allocator Alloc>
140 template<concepts::Impl<meta::List<AsWritableByteSpan>> T>
145 auto store =
DI_TRY(Store::create(di::forward<T>(value)));
151 template<concepts::Impl<meta::List<AsWritableByteSpan>> T>
166 m_store = di::move(other.m_store);
170 constexpr auto data() const ->
byte* {
return m_data.data(); }
171 constexpr auto size() const ->
usize {
return m_data.size(); }
172 constexpr auto span() const ->
Span<
byte> {
return m_data; }
173 constexpr auto empty() const ->
bool {
return m_data.empty(); }
177 return di::move(*this).m_store;
Definition optional_forward_declaration.h:5
Definition span_forward_declaration.h:10
Definition byte_buffer.h:76
constexpr auto span() const -> Span< byte const >
Definition byte_buffer.h:100
constexpr auto slice(usize offset, usize count) const -> Optional< ByteBufferImpl >
Definition byte_buffer.h:123
constexpr ByteBufferImpl(Span< byte const > data, Store &&store)
Definition byte_buffer.h:95
ByteStore< Alloc > Store
Definition byte_buffer.h:78
constexpr auto size() const -> usize
Definition byte_buffer.h:99
constexpr auto slice(usize offset) const -> Optional< ByteBufferImpl >
Definition byte_buffer.h:117
constexpr auto empty() const -> bool
Definition byte_buffer.h:101
static constexpr auto create(T &&value) -> meta::LikeExpected< meta::AllocatorResult< Alloc >, ByteBufferImpl >
Definition byte_buffer.h:83
constexpr auto data() const -> byte const *
Definition byte_buffer.h:98
constexpr auto first(usize count) const -> Optional< ByteBufferImpl >
Definition byte_buffer.h:105
constexpr auto last(usize count) const -> Optional< ByteBufferImpl >
Definition byte_buffer.h:111
constexpr ByteBufferImpl(Span< byte const > data, Store const &store)
Definition byte_buffer.h:96
constexpr ByteBufferImpl(T &&value)
Definition byte_buffer.h:93
ByteBufferImpl ByteBuffer
Definition byte_buffer.h:79
constexpr auto store() const &-> Store const &
Definition byte_buffer.h:103
Definition byte_buffer.h:135
constexpr auto shrink_to_slice(usize offset)
Definition byte_buffer.h:182
constexpr auto store() &&-> Store &&
Definition byte_buffer.h:175
constexpr auto span() const -> Span< byte >
Definition byte_buffer.h:172
ExclusiveByteBufferImpl()=default
ByteBufferImpl< Alloc > ByteBuffer
Definition byte_buffer.h:138
constexpr auto size() const -> usize
Definition byte_buffer.h:171
constexpr auto empty() const -> bool
Definition byte_buffer.h:173
constexpr auto shrink_to_slice(usize offset, usize count)
Definition byte_buffer.h:183
constexpr auto shrink_to_first(usize count)
Definition byte_buffer.h:180
constexpr auto operator=(ExclusiveByteBufferImpl const &) -> ExclusiveByteBufferImpl &=delete
constexpr ExclusiveByteBufferImpl(T &&value)
Definition byte_buffer.h:153
constexpr ExclusiveByteBufferImpl(ExclusiveByteBufferImpl const &)=delete
constexpr auto shrink_to_last(usize count)
Definition byte_buffer.h:181
constexpr ExclusiveByteBufferImpl(ExclusiveByteBufferImpl &&other)
Definition byte_buffer.h:160
static constexpr auto create(T &&value) -> meta::LikeExpected< meta::AllocatorResult< Alloc >, ExclusiveByteBufferImpl >
Definition byte_buffer.h:142
constexpr auto operator=(ExclusiveByteBufferImpl &&other) -> ExclusiveByteBufferImpl &
Definition byte_buffer.h:165
ByteStore< Alloc > Store
Definition byte_buffer.h:137
constexpr auto share() &&-> ByteBuffer
Definition byte_buffer.h:187
constexpr ExclusiveByteBufferImpl(Span< byte > data, Store &&store)
Definition byte_buffer.h:156
constexpr auto data() const -> byte *
Definition byte_buffer.h:170
Definition operations.h:99
Definition operations.h:114
Definition allocator.h:20
Definition tag_invoke.h:33
#define DI_TRY(...)
Definition monad_try.h:13
Any< Interface, SharedStorage< Alloc > > AnyShared
Definition any_shared.h:9
size_t usize
Definition integers.h:33
Definition byte_buffer.h:20
AnyShared< meta::List<>, Alloc > ByteStore
Definition byte_buffer.h:67
Definition zstring_parser.h:9
constexpr tag_invoke_detail::TagInvokeFn tag_invoke
Definition tag_invoke.h:22
constexpr auto exchange(T &object, U &&new_value) -> T
Definition exchange.h:8
vocab::byte_buffer::ExclusiveByteBufferImpl<> ExclusiveByteBuffer
Definition byte_buffer.h:202
constexpr auto as_writable_byte_span
Definition byte_buffer.h:61
constexpr auto count
Definition count.h:37
vocab::byte_buffer::ByteBufferImpl<> ByteBuffer
Definition byte_buffer.h:201
constexpr auto as_byte_span
Definition byte_buffer.h:62
Definition byte_buffer.h:40
Method< AsByteSpan, Span< byte const >(This const &)> Type
Definition byte_buffer.h:41
Definition byte_buffer.h:21
Method< AsWritableByteSpan, Span< byte >(This &)> Type
Definition byte_buffer.h:22