-
-
Notifications
You must be signed in to change notification settings - Fork 31
Added EcoBytes struct #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov ReportPatch coverage:
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more Additional details and impacted files@@ Coverage Diff @@
## main #23 +/- ##
==========================================
- Coverage 92.21% 85.31% -6.91%
==========================================
Files 4 4
Lines 1041 1212 +171
==========================================
+ Hits 960 1034 +74
- Misses 81 178 +97
... and 1 file with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
|
@reknih any updates on whether I can expect this to be merged? Thanks! |
laurmaedje
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the long wait. PRs outside typst/typst sometimes fly under my radar.
| /// Returns `Err(())` if the vector's length exceeds the capacity of | ||
| /// the inline storage. | ||
| #[inline] | ||
| pub const fn try_inline(bytes: &[u8]) -> Result<Self, ()> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thinking returning Option would be preferrable over having () as an error.
|
|
||
| /// Create a new, inline vector. | ||
| /// | ||
| /// Panics if the vector's length exceeds the capacity of the inline |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /// Panics if the vector's length exceeds the capacity of the inline | |
| /// Panics if the slice's length exceeds the capacity of the inline |
|
|
||
| #[inline] | ||
| pub(crate) const fn from_inline(inline: InlineVec) -> Self { | ||
| Self(Repr { inline }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this function doesn't really pull it's weight in my opinion
|
|
||
| #[inline] | ||
| pub fn insert(&mut self, index: usize, value: u8) -> Result<(), ()> { | ||
| //TODO: optimize? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a custom implementation with ptr::copy (like in vec.rs) does make sense here.
| } | ||
|
|
||
| #[inline] | ||
| pub fn remove(&mut self, index: usize) -> u8 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above (like in vec.rs)
|
Could you also adjust the README and crate-level docs and briefly show |
|
Closing this due to inactivity. Feel free to reopen it if you want to continue working on this. |
Add
EcoBytes, which is the same asEcoStringbut holds a raw byte vector rather than a UTF-8 string; this is implemented by makingDynamicVecpublic.