11 Commits (119a32840af242289d68e4ec1bcccac69d9fd902)

Author SHA1 Message Date
pantonshire 119a32840a strings: fill in safety comments for CappedString
This patch fills in some missing safety comments in the implementation
of `CappedString`, and adds some additional comments for clarity.
3 years ago
pantonshire 0d88775366 strings: implement push and push_truncating for CappedString
This patch implements the `CappedString::push` and
`CappedString::push_truncating` methods, which are like
`CappedString::push_str` and friends but take a single character rather
than a string slice.
3 years ago
pantonshire 2d5343681a strings: WIP CappedString::push_str and friends
This patch implements `CappedString::push_str` and its truncating
counterpart, `CappedString::push_str_truncating`. These methods provide
a safe API to append additional string data to the end of a
`CappedString`.

This is a work-in-progress and, like the rest of `CappedString`,
requires unit testing.
3 years ago
pantonshire c50b3c7daa strings: implement `CappedString::new` using `CappedString::from_raw_ptr`
This patch replaces the logic in `CappedString::new` for copying the
string data into a `[MaybeUninit<u8>]` buffer with a call to
`CappedString::from_raw_ptr`, which performs the same task.
3 years ago
pantonshire 4917be0963 strings: WIP CappedString refactoring and improvements
This patch changes the name of the CappedString error type to be more
descriptive, adds inline and must_use annotations to more public
functions, and begins implementing a wider variety of ways to create a
CappedString.
3 years ago
pantonshire c8783caae2 strings: CappedString now uses a MaybeUninit buf
CappedString was previously backed by a `[u8; N]`, which required
zeroing the buffer on creation. It now uses a `[MaybeUninit<u8>; N]`,
which does need to be zeroed. This should improve the performance of
creating a new CappedString, at the cost of slightly more unsafe code
required in its implementation.

Additionally, `as_bytes` and `as_bytes_mut` methods were introduced.
These are primarily used internally in the implementation of
CappedString, but are also provided as part of the public API to allow
users to do low-level operations on the underlying buffer backing the
CappedString. `as_bytes_mut` is unsafe, as this method can be used to
violate the UTF-8 property of the CappedString, which is undefined
behaviour.
3 years ago
pantonshire 299553bebf Documentation for CappedString 3 years ago
pantonshire d4c064c92e Conversions between CappedString and Box<str> 3 years ago
pantonshire d0ea531c05 RFC 3986 percent encoding, std feature now depends on alloc feature 3 years ago
Pantonshire 0b4dbc6bc5 no_std support 3 years ago
Pantonshire 4d4e4486d1 ShString is now InliningString 3 years ago